i cant understand why this happens
i m making a simple implentation of sieve of eratosthenes algorithm but code doesnt run on gcc
// calculate primes from 1 to 100
#include <stdio.h>
#include <math.h>
int main() {
unsigned long i,x[99],w;
for ( i=1; i<100; i++ ) {
x[i] = i+1;
}
for ( i=2; i<100; i++ ) {
if ( x[i] % 2 == 0 ) {
x[i] = 0;
}
}
for ( i=3; i<sqrt(100); i++ ) {
if ( x[w] != 0) {
for ( w=i; w<100; w++ ) {
if ( x[w] % i == 0 ) {
x[w] = 0;
}
}
}
}
for ( i=1; i<100; i++ ) {
if ( x[i] != 0 ) {
printf("prime number: %lu\n", x[i]);
}
}
getchar();
return 0;
}
any help?