java 九九乘法口诀

java 写九九乘法口诀:

 倒三角形

public class multipy {
    public static void main(String[] args) {
        System.out.println("********乘法口诀表********");
        for (int i = 9;i >0; i--) {
            for (int j = 1;j < 10; j++) {
                int M = i * j;
                if(i>=j) {
                    System.out.print(i + "*" + j + "=" + M +"\t");

                }
            }
            System.out.print("\n");
        }
    }
}

三角形

public class multipy1 {
    public static void main(String[] args) {
    System.out.println("********乘法口诀表********");
    
    for (int i = 1;i<10; i++) {
        for (int j = 1;j < 10; j++) {
            int M = i * j;
            if(i>=j) {
                System.out.print(i + "*" + j + "=" + M +"\t");
            }
        }
        System.out.print("\n");
    }
}
}

猜你喜欢

转载自blog.csdn.net/qwert789p/article/details/87369527
今日推荐