write the program for prime numbers?
Answer Posted / karthik
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c=0,i;
clrscr();
printf("enter any number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
c++;
}
(c==2)? printf("%d is a prime number",n):
printf("%d is not a prime number",n);
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the use of structure padding in c?
Why is c called a structured programming language?
Can a pointer point to null?
Why are algorithms important in c program?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
How can I run c program?
What are the advantages and disadvantages of pointers?
When should the volatile modifier be used?
What is structure in c definition?
Do you have any idea how to compare array with pointer in c?
Can you please explain the difference between exit() and _exit() function?
What is spaghetti programming?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
Explain the difference between ++u and u++?