# C program to find the prime numbers between a range using while loop

## Program to find the Prime numbers between a Range using While loop

Prime number is an Integer number. The Prime number can be divisable by 1 and the number itself. If a number has more positive divisors other than 1 and the number itself, then the number is not Prime number. For example: 2, 3, 5, 7, 11, 13, 17  . . . are Prime numbers. The below given C program to find the prime numbers between a range using while loop. Kindly check out the program to display the prime numbers between a range.

### Program to display the prime numbers using while loop

#include<stdio.h>

int main(){

int numbr,k,remark,first,last;

printf("Give the First Number for the Range : ");
scanf("%d",&first);
printf("\n Give the Last Number for the Range : ");
scanf("%d",&last);

numbr= first;

while(numbr<= last)

{

remark=0;

k=2;

while(k<=numbr/2)

{

if((numbr % k) == 0){

remark++;

goto jump;

}

k++;

}

if(remark==0)

printf("\n    %d ",numbr);

jump:

++numbr;

}

return 0;

}

Sample output:

Give the First Number for the Range :  20

Give the Last Number for the Range  :  40

23

29

31

37