SIEVE HYPOTHESIS


This program generates prime numbers using the elegant sieve logic.


#include"stdio.h"
main()
{
int a,b,c,d,n;
int t[1000];
clrscr();
printf("PRIME NUMBERS BY SIEVE METHOD\n");
for(a=1;a<100;a++)
t[a]=a;
b=2;
while(b<100)
{
n=2;
if (t[b]==0)
b++;
c=b*n;
while(c<100)
{
c=b*n;
t[c]=0;
n++;
}
b++;
}
for(a=1;a<100;a++)
if(t[a]!=0)
printf("%d ",t[a]);
getch();
}


Go to the programs page click here!!

Hosted by www.Geocities.ws

1