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


Please Help Members By Posting Answers For Below Questions

List some of the static data structures in C?

768


Why is c platform dependent?

630


What are unions in c?

592


Where static variables are stored in c?

599


How does #define work?

660






How is null defined in c?

662


When the macros gets expanded?

804


What are identifiers and keywords in c?

584


What is the use of pragma in embedded c?

597


Is null always defined as 0(zero)?

623


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1679


What is the difference between void main and main in c?

638


Why is void main used?

628


Explain what are reserved words?

646


Where is c used?

662