testc
C
code posted
by
KinmenHackerFromTaiwan
created at 20 May 05:21, updated at 21 May 12:27
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include <stdlib.h> #include <stdio.h> #define N 10000 void main(int argc, char *argv){ int i, j, a[N]; for(i = 2; i < N; i++) a[i] = 1; for(i = 2; i < N; i++) if(a[i]) for(j = i; i * j < N; j++) a[i * j] = 0; for(i = 2; i < N; i++) if(a[i]) printf("%4d", i); printf("\n"); } |
318 Bytes in 2 ms with coderay