解读一下这个c程序?
#include<stdio.h>enum{NUM=200};intan[NUM+1];intmain(){inti,j;an[0]=an[1]=0;for(i=2;i<...
#include <stdio.h>
enum {NUM =200};
int an[NUM+1];
int main (){
int i, j;
an[0] =an[1] = 0;
for (i=2; i<=NUM; ++i )
an[i]=1;
for (i=2; i*i<=NUM ;++i)
if(an[i] ==1)
for(j =i*2; j<=NUM ; j+=i)
an[j] =0;
for (i=2,j=0; i<=NUM ;++i)
if (an[i] !=0)
printf ("%d%c",i ,((++j)%10 ==0 ? '\n' :' '));
putchar ('\n');
return 0;
} 展开
enum {NUM =200};
int an[NUM+1];
int main (){
int i, j;
an[0] =an[1] = 0;
for (i=2; i<=NUM; ++i )
an[i]=1;
for (i=2; i*i<=NUM ;++i)
if(an[i] ==1)
for(j =i*2; j<=NUM ; j+=i)
an[j] =0;
for (i=2,j=0; i<=NUM ;++i)
if (an[i] !=0)
printf ("%d%c",i ,((++j)%10 ==0 ? '\n' :' '));
putchar ('\n');
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询