
#include <stdio.h>
int main()
{
int n, i, c=0;
printf("Enter the number: ");
scanf("%d", &n);
for(i=1;i<=n;i++)
{
if(n % i == 0)
{
c++;
}
}
if(c == 2)
{
printf("\nThe given number is a prime
number\n");
}
else
{
printf("\nThe given number is not a prime
number\n");
}
return 0;
}
No comments:
Post a Comment