Java for loop print shape using nested for loop 2

Question

We would like to output the following shape using nested for loop.


**********//from w  w w  .j  av a2 s.  c  o  m
*********
********
*******
******
*****
****
***
**
*


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



PreviousNext

Related