Write a program to find whether the given number is prime or
not?
Answer Posted / md.ershad ezaz
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,c;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
c=0;
for(i=1;i<=n;i++)
{
if(n%i==0)
c=c+1;
}
if(c==2)
printf("%d is prime",n);
else
printf("%d is not prime",n);
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are void pointers in c?
What is malloc and calloc?
What is static and volatile in c?
What is variables in c?
By using C language input a date into it and if it is right?
What is void main () in c?
Explain heap and queue.
How old is c programming language?
What is a c token and types of c tokens?
Does c have circular shift operators?
What is && in c programming?
What is formal argument?
State the difference between realloc and free.
What is c standard library?
How do I read the arrow keys? What about function keys?