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
what is use of malloc and calloc?
What is variable declaration and definition in c?
What is identifier in c?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
There seem to be a few missing operators ..
What are the advantages of using linked list for tree construction?
The statement, int(*x[]) () what does in indicate?
What is fflush() function?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
In a switch statement, explain what will happen if a break statement is omitted?
What is the difference between pure virtual function and virtual function?
What is uint8 in c?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What is the difference between scanf and fscanf?
What are the two forms of #include directive?