hello, following is the program for finding prime number it also prints about other number are prime number or not. if you want to print only prime numbers just remove last printf statement of the program.and "is a prime number" in previous printf statement.
i does not found your source now but yesterday i see it and there is a
"&" in printf statement in while loop.
#include<stdio.h>
main()
{
int check, i, x,y,m;
printf("enter the number upto which check");
scanf("%d",&check);
y=1;
for(m=2; m<=check; m++)
{
for(x=2;x<m; x++)
{ y=m%x;
if(y==0)
break;
}
if(y!=0)
printf("%d is prime number\n",m);
else printf("%d is not a prime number\n",m);
}
getch();
}