/*eratosthenes sieve program in c*/
#include "libc.h"
#define true 1
#define false 0
#define size 1000
#define	ERT	285
   char flags[size+1];
main ( )
{
int i,prime,k,count,iter;
/*printf("10 iteration\n");*/
for(iter=1;iter<=10;iter++) /*do program 10 times*/
{
count=0; /*prime counter*/
for(i=0;i<=size;i++) /*set all flags  */
flags[i]=true;
for(i=0;i<=size;i++)
{
if(flags[i])       /*found a prime*/
{
prime=i+i+3;
/*printf("%d",prime);*/
for (k=prime+prime;k<=size;k+=prime)
flags[k]=false;   /*kill all multiples*/
count++;
}
}
}
/*printf ("%d primes.",count);*/  /*primes found on 10 path*/ 
if(count == ERT )
printf("SIEVE PASSED \n");
else
printf("SIEVE  FAILED \n");
exit(0);
}


