用for循环输出一个直角三角形,要用到break。

解决方案 »

  1.   


    public class 三角形 {
         public static void main( String[] args) {
        for(int i=0;i<5;i++) {
        for(int j=0;j<=5-i;j++) {
        System.out.print(" ");
        }
        for(int k=0;k<=i*2;k++) {
        System.out.print("*");
        }
         
            System.out.println();
        }
         }
         
    }
      

  2.   


    /**
     * <p>直角三角形</p>
     */
    public class RightTriangle {
    public static void main(String[] args) {

    for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
    if(j>i){
    System.out.println();
    break;
    }
    System.out.print("A");
    }
    }
    }
    }
      

  3.   

    我的代码和M丶lang的一样!