#include <stdio.h>
#include <conio.h>
int main( )
{
int n,c;
printf("Enter a Number\n");
scanf("%d",&n);
if(n==2)
printf("Prime Number\n");
else{
for(c=2;c<=n-1;c++)
{
if(n%c==0)
break;
}
if(c!=n)
printf("Not Prime Number\n");
else
printf("Prime Number\n");
}
getch ( );
return 0;
}
#include <conio.h>
int main( )
{
int n,c;
printf("Enter a Number\n");
scanf("%d",&n);
if(n==2)
printf("Prime Number\n");
else{
for(c=2;c<=n-1;c++)
{
if(n%c==0)
break;
}
if(c!=n)
printf("Not Prime Number\n");
else
printf("Prime Number\n");
}
getch ( );
return 0;
}
No comments:
Post a Comment