package com.Cx_330.array;
import java.util.Random;
import java.util.Scanner;
public class ArrayPlay {
public static boolean isPrime(int i){
for (int j = 2; j <Math.sqrt(i); j++) {
if(i%j==0){
return false;
}
}
return true;
}
public static void main(String[] args) {
int count=0;
System.out.println("101到200之间的素数为: ");
for (int i = 101; i <=200 ; i++) {
if(isPrime(i)){
count++;
System.out.println(i);
}
}
System.out.println("101到200之间的素数的个数为: "+count);
}
}
12-16
299
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-23
8468
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-12
3910
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)