*Display Prime Numbers Between Two Intervals
#include<stdio.h>
int main()
{
int n1, n2, i, j, flag=0;
printf("Enter the number\n");
printf("n1 is small n2 is large\n");
scanf("%d%d", &n1, &n2 );
for(i=n1;i<=n2;i++)
{
for(j=2;j<=i/2;j++)
{
if(i%j==0)
{ flag++;}
}
if(flag==0)
printf("%d\n ", i);
}
return 0;
}
Comments
Post a Comment