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
C language questions for civil engineering
Why is struct padding needed?
What is unary operator?
What is #line in c?
Can you return null in c?
How pointers are declared?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Is main is a keyword in c?
What is the difference between null pointer and wild pointer?
i want to know the procedure of qualcomm for getting a job through offcampus
What is the purpose of & in scanf?
provide an example of the Group by clause, when would you use this clause
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
How can I implement sets or arrays of bits?
What is the significance of an algorithm to C programming?