找出101到200之间的素数
public class PrimeNumberTest { //找出101与200之间的素数 public static void main(String[] args) { int a = 101; int b = 200; System.out.println("" + a + "与" + b + "之间的素数是:"); for (int i = a; i <= b; i++) { boolean flag = true; for (int j = 2; j < i; j++) { if (i % j == 0) { flag = false; break; } } if (flag == true) { System.out.println(i); } } } }