一个简单的九九乘法表的打印输出,对for循环的认识

public static void main(String[] args) {
        // 乘法表输出
        /*
         * for(int i =1;i < 10;i++){ if (i == 1) {
         * 
         * }else { System.out.println(""); } for(int j = 1;j < i+1;j++){
         * System.out.print(j+"*"+i+"="+(i*j)+" "); } } }
         */
        // 打印乘法口诀半边大树
        for (int a = 0; a < 10; a++) {
            // 忽略为0和1时的空白
            if (a <= 1) {

            } else {
                System.out.println();
            }
            for (int i = 1; i < a + 1; i++) {
                if (i == 1) {

                } else {
                    System.out.println();
                }
                for (int j = 1; j < i + 1; j++) {
                    System.out.print(j + " * " + i + " = " + (i * j) + "  ");
                }
            }
        }

    }

在闲暇之余无意中看到这样一个题觉得简单便写了一下,发现自己还未完全掌握多重循环的变换使用,只要你熟练掌握就能打印出很多东西,所以学习一门编程语言,基础真的真的非常重要,笔者拙见,不喜勿喷

原文地址:https://www.cnblogs.com/fatebyme/p/6717843.html