/*To find the prime number between 3980 and 3990*/
#include<stdio.h>
#include<math.h>
void
main()
{
int
n,i,remainder,d;
for(n=3980;n<=3990;n++)
{
d= sqrt(n);
for(i=2;i<d;i++)
{
remainder=n%i;
if(remainder==0)
{
goto
label;
}
}
printf("the
number %d is prime\n",n);
label:;}
}
Result:
the number 3989 is prime
Press any key to continue
No comments:
Post a Comment
Thanks for comment.