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
List some of the static data structures in C?
Why is c platform dependent?
What are unions in c?
Where static variables are stored in c?
How does #define work?
How is null defined in c?
When the macros gets expanded?
What are identifiers and keywords in c?
What is the use of pragma in embedded c?
Is null always defined as 0(zero)?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
What is the difference between void main and main in c?
Why is void main used?
Explain what are reserved words?
Where is c used?