#include<stdio.h>
#include<math.h>
int main()
{
int N=1000,i;
while (N<=2000) //求1000~2000之间的素数
{
i=2;
while (i<=(int)sqrt(N)) //判断一个数是否为素数,是否有其他的办法?期待之后的学习。
{
if (N%i==0) i=N;
else i++;
}
if (i<N) printf("%12d",N);
N++;
}
return 0;
}
备注:自己写的,有待后面的学习而检验