2020-10-07

    科技2024-11-24  27

    *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) { // TODO Auto-generated method stub //外层行循环 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(); } } }
    Processed: 0.012, SQL: 8