i wrote a c prgm tocheck if a number is prime. i cant seem to find anything wrong...

Divinity

New member
...with it! please tell me!? main()
{
int n,i,d=1;
printf("Enter number");
scanf("%d",&n);
for(i=2;i<n||d==0;i++)
{
d=n%i;
}
if(d==0)
printf("Prime");
else
printf("not prime");
}
 
Back
Top