正向乘法表
for (int i = 1; i<=9; i++) {for (int j = 1; j <= i; j++) {System.out.print(j + "X" + i + "=" + (i * j) + "\t");}System.out.println();}
代码结果:
打印反向乘法表
for (int i = 9; i >= 1; i--) {for (int j = 1; j <= i; j++) {System.out.print(j + "X" + i + "=" + (i * j) + "\t");}System.out.println();}
代码结果: