#include <stdio.h>
#include <math.h>
int
even (int n)
{
return (n%2==0);
}
int
prime (int n)
{
int divisor, i;
divisor = 0;
if (even (n))
{
if (n == 2)
divisor = 0;
else
divisor = 2;
}
else
{
if (n == 1)
divisor = 0;
else
for (i = 3; i < n; i = i + 2)
{
if (n % i == 0)
divisor = i;
}
}
return (!divisor);
}
int
main (void)
{
int x;
printf ("Enter a positive integer number: ");
scanf ("%d", &x);
if (prime (x))
printf ("%d is a prime number.\n", x);
else
printf ("%d is not a prime number.\n", x);
return (0);
}