public class A
{
public static void main(String[] args)
{
// TODO Auto-generated method stub
int i=0;
for(int x=101;x<=200;x++)
{
int y=x-1;
while(x%y!=0)
{
y--;
}
if(y==1)
{
System.out.println(x);
i++;
}
}
System.out.printf("一共有%d个素数",i);
}
}
判断101-200之间有多少个素数,并输出所有素数
最新推荐文章于 2020-02-17 23:28:33 发布