Printing *s as triangles in Java?

后端 未结 21 1915
囚心锁ツ
囚心锁ツ 2020-11-30 11:41

My assignment in my Java course is to make 3 triangles. One left aligned, one right aligned, and one centered. I have to make a menu for what type of triangle and then input

21条回答
  •  无人及你
    2020-11-30 12:38

    public class triangle {
        public static void main ( String arg[] ){
    
            System.out.print("Enter Triangle Size : ");
            int num=0;
            try{
                num=Integer.parseInt( read.readLine() );
            } catch(Exception Number){
                System.out.println("Invalid Number!");
            }
                for(int i=1;i<=num;i++){
                    for(int j=1;j

提交回复
热议问题