/* Prime number using for loop */
#include<stdio.h>
int main()
{
int a,i,f;
printf("Enter a number: ");
scanf("%d",&a);
f=0;
for(i=2;i <= a/2;i++)
{
if(a%i == 0)
{
f=1;
break;
}
}
if(f==0)
printf("Prime Number")
else
printf("Not Prime Number");
return 0;
}
Related Post
Prime Number using while loop
http://cbasicprogram.blogspot.in/2012/03/prime-number-using-while-loop.html
#include<stdio.h>
int main()
{
int a,i,f;
printf("Enter a number: ");
scanf("%d",&a);
f=0;
for(i=2;i <= a/2;i++)
{
if(a%i == 0)
{
f=1;
break;
}
}
if(f==0)
printf("Prime Number")
else
printf("Not Prime Number");
return 0;
}
Related Post
Prime Number using while loop
http://cbasicprogram.blogspot.in/2012/03/prime-number-using-while-loop.html
how to find prime no using odd loop
ReplyDeleteAttention everyone, the file provided above is not working. I have been looking for the working file and finally found it.
Delete✔️Click Here To Download http://gestyy.com/e0GAyS
✔️Click Here To Download
✔️Click Here To Download http://exe.io/XONVsO6l
✔️Click Here To Download
✔️Click Here To Download
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Mn.
..
.
.
.
..
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.cx
.
.
.sdcccxxxcx
you forgot to use ';' in printf
ReplyDeletethis is a wrong program why i example it is infinitive time loop work
ReplyDeletenot working on 49,55.......
ReplyDeletewrong program
ReplyDeletetotally wrong program
ReplyDeletefor loop should contain "a-2" instead of "a/2".
ReplyDeleteVery easy program
ReplyDelete; is missing on 17 row...
ReplyDeleteThis comment has been removed by the author.
ReplyDelete
ReplyDeletePrime Number Program in C using for loop