1 /*
2 輸出100以內所有6的倍數,每5個一行
3 */
4 public class Demo {
5 public static void main(String[] args){
6 System.out.println("100以內所有6的倍數:");
7 int num = 0;
8 for (int i = 1; i < 100 ; i++) {
9 if (i%6 == 0){
10 System.out.print(i + ",");
11 num++;
12 }
13 if (num == 5){
14 System.out.println();
15 num = 0;
16 }
17 }
18 }
19 }
原文出處:https://www.cnblogs.com/wangjixue/p/12118929.html