how to find the given number is prime or not?
Answer Posted / rahul tiwari
main()
{
int n,ctr=2,flag=0;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=n/2;ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
flag=9
getch();
}
| Is This Answer Correct ? | 8 Yes | 7 No |
Post New Answer View All Answers
Why does not c have an exponentiation operator?
What is n in c?
pierrot's divisor program using c or c++ code
How many types of arrays are there in c?
What is the sizeof () operator?
What is the use of sizeof () in c?
Is c programming hard?
difference between native and cross compilers
What are the header files used in c language?
What is preprocessor with example?
What is static identifier?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
What is the return type of sizeof?
Are there constructors in c?
What does c mean in standard form?