2023-12-06 18:21:31 +00:00
|
|
|
import "import/defs.eh"
|
2022-03-06 02:28:42 +00:00
|
|
|
|
|
|
|
long num[100];
|
|
|
|
int :: main() {
|
2023-12-08 03:01:56 +00:00
|
|
|
long i = 0;
|
|
|
|
long j = 0;
|
2022-03-06 02:28:42 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|