write the program for prime numbers?

Answer Posted / felix c. intelegando

#include<stdio.h>
#include<conio.h>


int main(void)
{
int i,n,count=0;
printf("Enter Number: ");
scanf("%d",&n);
for(i=2;i<n;i++)

{
if(n%i==0)
{
count++;
}
}
if(count>1)
{
printf("Not Prime ");

}
else
printf("Prime");

getch();
return 0;
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain c preprocessor?

684


What is meant by 'bit masking'?

889


What is a program flowchart and explain how does it help in writing a program?

679


Explain #pragma statements.

605


Is c procedural or object oriented?

583






What is table lookup in c?

632


Why is structure padding done in c?

650


How does struct work in c?

611


What is difference between constant pointer and constant variable?

631


What is FIFO?

677


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1599


What is difference between && and & in c?

600


What is d scanf?

596


Why is it that not all header files are declared in every C program?

684


What is adt in c programming?

612