title: Drawing shapes using java for loops
body: <p>I'm just getting started with Java and my teacher asked me to draw the following two shapes using nested for loops.</p>
  
  <pre><code>     *     
      ***    
     *****   
    *******  
   ********* 
  ***********
  
       *
      * *
     *   *
    *     *
   *       *
  ***********
  </code></pre>
  
  <p>However, I was able to draw the first figure using the following code.</p>
  
  <pre><code>class TriangleDrawing{
  
      public static void main(String args[]){
  
          for(int x = 1; x &lt;= 6; x++){
  
              for(int y = 1; y &lt;= (6-x); y++){
  
                  System.out.print(" ");
  
              }
  
              for(int z = 0; z &lt; (x + (x-1)); z++){
  
                  System.out.print("*");
  
              }
  
              for(int p = 1; p &lt;= (6-x); p++){
  
                  System.out.print(" ");
  
              }
  
              System.out.println();
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>I'm having trouble with drawing the second figure.<br>
  Can anyone help me out drawing that one, by using nested for loops?</p>