#include <stdio.h>
#include <math.h>
int main(){
int a,b,j,i=2,t=0,n=0;
scanf("%d %d",&a,&b);
int m[b+1];
while(n<=b+1){
for(j=2;j<=sqrt(i);j++)
if(i%j==0){
t++;
break;
}
if(t==0){
m[n]=i;
n++;
}
t=0;
i++;
}
int x=0;
for(j=a-1;j<b-1;j++){
x++;
if(x%10==0)
printf("%d\n",m[j]);
else
printf("%d ",m[j]);
}
printf("%d",m[j]);
return 0;
}
PAT 数素数C语言
最新推荐文章于 2022-11-17 16:36:12 发布