使用for嵌套循环,打印下列图案
      **********
       *********
        ********
         *******
          ******
           *****
            ****
             ***
              **
               *
 想了蛮久,还是没做出来。希望可以把代码写下,跪谢~

解决方案 »

  1.   

    public class Test {
    public static void main(String args[]){
    for (int i = 10; i>0; i--){
    for (int j = i; j>0; j--){
    System.out.print("*");
    }
    System.out.println ();
    }
    }
    }
      

  2.   

    稍微改一下楼上的代码public class Test {
    public static void main(String args[]){
    for (int i = 10; i>0; i--){
    for (int j=0; j<10; j++){
    if (j<10-i) {System.out.print(" ");}
    else {System.out.print("*");}
    }
    System.out.println ();
    }
    }
    }