#include <stdio.h>
#define VERSION "1.0"
int isPrime(int prime)
{
int count=2;
if(prime==1)
{
return 0;
}
else if(prime==2)
{
return 1;
}
else
{
while(prime%count!=0 &&
count*count<=prime)
{
count++;
}
return (prime%count==0)?0:1;
}
}
void printVersion()
{
printf("Primality checker
version %s\n", VERSION);
printf("Compiled on %s
%s\n", __DATE__, __TIME__);
}
int main()
{
int i=1;
const int max_prime=2500;
printVersion();
for(i=1;i<max_prime;i++)
{
if(isPrime(i))
{
printf("%d is
prime\n",i);
}
else
{
printf("%d is not
prime\n",i);
}
}
return 0;
}
prime.c: In function ‘printVersion’:
prime.c:28: error: ‘_DATE_’ undeclared (first use in this function)
prime.c:28: error: (Each undeclared identifier is reported only once
prime.c:28: error: for each function it appears in.)
prime.c:28: error: ‘_TIME_’ undeclared (first use in this function)