32 lines
497 B
Plaintext
32 lines
497 B
Plaintext
|
import "tests/import/defs.eh"
|
||
|
|
||
|
long num[100];
|
||
|
int :: main() {
|
||
|
long i;
|
||
|
i = 0;
|
||
|
long j;
|
||
|
j = 0;
|
||
|
|
||
|
for (i = 0; i < 100; i++) {
|
||
|
num[i] = i + 1;
|
||
|
}
|
||
|
|
||
|
for (i = 1; (num[i] * num[i]) <= 100; i++) {
|
||
|
if (num[i] != 0) {
|
||
|
for (j = num[i] * num[i]; j <= 100; j = num[i] + j) {
|
||
|
num[j - 1] = 0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("Finding primes 2..%d\n\n",100);
|
||
|
|
||
|
for (i = 1; i < 100; i++) {
|
||
|
if (num[i] != 0) {
|
||
|
printf("%d\t", num[i]);
|
||
|
}
|
||
|
}
|
||
|
printf("\n");
|
||
|
|
||
|
return (0);
|
||
|
}
|