二维数组打印乘法表,三角形,输入三个数,输出最大值

public class ShuZuText {
    public static void main(String []args)
    {
//        bijiaodaxiao();
        
        jiujiuchengfabiao();
        
        sanjiaoxing();
        
    }

    private static void sanjiaoxing() {
        for(int i = 1;i<=5;i++){
            for(int j = 5-i;j >= 1;j--){
                System.out.print(" ");
            }
            for(int m=1;m<=2*i-1;m++){
                if(i==1){System.out.print("A");}
                if(i==2){System.out.print("B");}
                if(i==3){System.out.print("C");}
                if(i==4){System.out.print("D");}
                if(i==5){System.out.print("E");}
                
            }
            System.out.println();
        }
    }

    private static void jiujiuchengfabiao() {
        int [][] s1= new int [][]{ {1} , {1,2} , {1,2,3} , {1,2,3,4} , {1,2,3,4,5} , {1,2,3,4,5,6} , {1,2,3,4,5,6,7} , {1,2,3,4,5,6,7,8} , {1,2,3,4,5,6,7,8,9}};
        for(int a=0;a<s1.length;a++){
            for(int b=0;b<s1[a].length;b++){
                System.out.print(s1[a].length+"*"+s1[a][b]+"="+s1[a].length*s1[a][b]+"  ");
            }
            System.out.println();
        }
    }

    private static void bijiaodaxiao() {
        Scanner s1 = new Scanner(System.in);
        int a=s1.nextInt();//输入a
    int b=s1.nextInt();//输入b
    int c=s1.nextInt();//输入c
        if(a>b&a>c){                //比较a与b,a与c的值,如果a大则输出a
            System.out.println(a);
        }else if(b>c){                //比较b与c的大小,输出大的
            System.out.println(b);
        }else{
            System.out.println(c);
        }
    }

}

 

posted @ 2017-07-12 20:11  fy02223y  阅读(279)  评论(0编辑  收藏  举报