for (i = 1; i <= 100; i++) { for (j = 1; j <= i; j++) { n = i % j; if (n == 0) { m = m + 1; } } if (m == 2) { System.out.print(i + " "); x = x + 1; } m = 0; } System.out.println(); System.out.println("1-100之间一共有素数" + x ...
for(int i = 0 ; i <= 100 ; i++){ if((i!=2)&&(i%2 == 0)) continue;if((i!=3)&&(i%3 == 0)) continue;if((i!=5)&&(i%5 == 0)) continue;if((i!=7)&&(i%7 == 0)) continue;System.out.println("素数为:"+i);} } 结果为:素数为:1 素数为:2 素...