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 the ANSI C Standard?
What is 2c dna?
How can I make it pause before closing the program output window?
What is the heap in c?
Can we change the value of static variable in c?
What are the rules for the identifier?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What are types of preprocessor in c?
What does the message "automatic aggregate intialization is an ansi feature" mean?
What are the advantages of c language?
how to capitalise first letter of each word in a given string?
How do we declare variables in c?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
How do you list files in a directory?
How can I find out how much free space is available on disk?