2 Answers
#include <stdio.h>
#include <stdlib.h>
int Isprime(int n);
int main()
{
int n;
printf(“enter a positive integer\n”);
scanf(“%d”, &n);
if (Isprime(n))
printf(“%d is a prime number\n”, n);
else
printf(“%d is not a prime number\n”, n);
return 0;
}
int Isprime(int n)
{
int i;
if (n == 1)
{
printf(“its a unique number\n”);
exit(0);
}
for (i = 2; i <= n / 2; i++)
{
if (n % i == 0)
{
return (0);
}
}
return 1;
}