<img src="https://img-blog.csdn.net/20150109160630265?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveGluNDEx/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
int a,b,i,c,d,q,n=0;
bool prime;
cin>>a>>b;
for(i=a;i<=b;i++)
{
prime=true;
d=sqrt(i);
for(c=2;c<=d;c++)
if(i%c==0)
{
prime=false;
break;
}
if(prime)
{
cout<<i<<" ";
n=n+1;
}
if(n%10==0)
cout<<endl;
}
cout<<endl;
return 0;
}
输出素数
最新推荐文章于 2023-08-20 17:45:24 发布