#include<stdio.h>
#include<conio.h>
void main()
{
int a,c=0,i,n;
clrscr();
printf("enter the number to be checked");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
a=n%i;
if(a=0)
{
c=c+1;
}
}
if (c=2)
{
printf("the given number is prime");
}
else
{
printf("the given number is not prime");
}
getch();
}
No comments:
Post a Comment