美文网首页
输出9 9乘法口决表

输出9 9乘法口决表

作者: 薛定谔的猴子 | 来源:发表于2016-07-28 18:14 被阅读50次

要求:

输出9 9乘法口决表

9  8   7  6  5  4 3 2 1 
18 16 14 12 10 8 6 4 
27 24 21 18 15 12 9 
36 32 28 24 20 16 
45 40 35 30 25 
54 48 42 36 
63 56 49 
72 64 
81 

完整代码如下:

public class T1 {
    public static void main(String[] args) {
        show(9);
    }

    public static void show(int n) {
        for (int i = 1; i <= n; i++) {//控制行数
            
            for (int j = n; j >= i; j--) {//控制列数
                
                System.out.printf("%3d", i * j);
            }
            System.out.println();
        }
    }
}

相关文章

网友评论

      本文标题:输出9 9乘法口决表

      本文链接:https://www.haomeiwen.com/subject/msiajttx.html