*11=1 12=2 22=4 13=3 23=6 33=9 … 前为列,后为行 定义 j 为列,i 为行,每一行当列数大于行数时就不输出即j <= i //外层行循环 for(int i = 1;i<=9,i++){ //内层列循环 for(int j = 1;j <= i;j++){ System.out.print(i + "" + j + “=” + (i * j) + “\t”); System.out.println(); } System.out.println(); }
public class Test {
public static void main(String
[] args
) {
for(int i
= 1;i
<=9;i
++){
for(int j
= 1;j
<= i
;j
++){
System
.out
.print(j
+ "*" + i
+ "=" + (j
* i
)+"\t");
}
System
.out
.println();
}
}
}