满意答案
fdewj590
2017.02.13
采纳率:40% 等级:9
已帮助:316人
12345678910111213141516171819public static void main(String[] args) { for (int i = 2; i <= 100; i++) { int temp = (int) Math.sqrt(i); if (i <= 3) { System.out.println(i + " is a prime"); } else { for (int j = 2; j <= temp; j++) { if (i % j == 0) { break; } if (j >= temp) { System.out.println(i + " is a prime"); } } } } }
00分享举报