Program Find Prime Number Between Two Interval Numbers

Table of Contents

Find Prime Number between Two Number

Program Find Prime Number Between Two Interval Number in C language
#include<conio.h>

#include<stdio.h>
void main()
{
int num1,num2,i,j,temp;

printf("enter the two number:\n");
scanf("%d %d",&num1,&num2);
for(i=num1+1;i<num2;i++){ // interval between two numbers
temp=0;
for(j=2;j<=i/2;++j){ //checking number is prime or not
if(i%j==0){
temp=1;
break;
}
}
if(temp==0)
printf("%d\n",i);
}
getch();
}
Output

 enter the two number:  3  ,45
5
7
11
13
17
19
23
29
31
37
41
43

Leave a Comment