1 今天是正式放假的第一天。
给出下面程序输出结果。答案是11 13 17 19 23 29
#include
#include
#include
bool fun(long n);
void main()
{long a=10,b=30,l=0;
if(a%2==0) a++;
for(long m=a;m<=b;m+=2)
if(fun(m))
{if(l++==0)
cout <<endl;
cout <<setw(5) <<m;
}
}
bool fun(long n)
{int sqrtm=(int)sqrt(n);
for(int i=2;i<=sqrtm;i++)
if(n%i==0)
return false;
return true;
}