标签:stdio.h printf col return span == 质数 class include
#include<stdio.h> #include<stdlib.h> int main(int argc, char *argv[]) { int i = 2, j = 0; long N = atol(argv[1]); int *a = malloc(N*sizeof(int)); if (NULL == a) { printf("There is no enough memory!\n"); return -1; } for(i=2; i<N; i++) a[i] = 1; for(i=2; i<N; i++) { if(a[i]) { for(j=i; j*i<N; j++) { a[i*j] = 0; } } } for(i=2; i<N; i++) { if(a[i]) printf("%4d ", i); } printf("\n"); return 0; }
标签:stdio.h printf col return span == 质数 class include
原文地址:https://www.cnblogs.com/cnpirate/p/8900735.html