public static void main(String[] args) {
int count = 0;
for (int i = 2; i < 101; i++) {
for (int j = 2; j <= i; j++) {
if (i % j == 0 && i != j)
break;
if (j == i) {
if (count % 5 == 0)
System.out.println();
System.out.print(j + " ");
count++;
}
}
}
System.out.println("\n素数有" + count + "个");
}

相关文章:

  • 2021-07-08
  • 2021-10-21
  • 2021-09-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2021-10-24
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2021-11-07
  • 2021-11-30
  • 2021-06-19
相关资源
相似解决方案