write the program for prime numbers?

Answer Posted / biswa

void main()
{
int i=2;
int count=0;
int n;
printf("enter a no");
scanf("%d",&n);
for(i=2;i<n/2;i++)
{
if(n%i==0)
{
count++;
}
if(count>1)
{
prinf("prime");
else
printf("not prime");
}

Is This Answer Correct ?    311 Yes 310 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of realloc()?

673


What does node * mean?

715


Find MAXIMUM of three distinct integers using a single C statement

624


How can I generate floating-point random numbers?

610


What is the process to generate random numbers in c programming language?

611






Define the scope of static variables.

607


What is c programming structure?

621


Explain how can a program be made to print the name of a source file where an error occurs?

692


What is a program flowchart?

606


What is function pointer c?

586


Is null valid for pointers to functions?

614


Write programs for String Reversal & Palindrome check

599


What is extern storage class in c?

514


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

666


What is a stream water?

659