title: How to add spaces to triangles
body: <p>So I've been at this for a while and I have am not sure how to do this so my professor wants us to print out triangles using for statements I accomplished this. But I have to add spaces to different columns in two of these triangles and I'm confused of how to do this. Here is what I have so far:</p>
  
  <pre><code>// Lab 11: Triangles.java
  // Program prints four triangles, one below the other
  public class Triangles
  {
     // draw four triangles
     public static void main( String args[] )
     {
        int row; // the row position
        int column; // the column position
        int space; // number of spaces to print
  
        // first triangle
        /* Write code to display the first triangle. Use nested for loops. The 
           outer loop should control which row of asterisks is being displayed.
           The inner loop should display one asterisk at a time. */
          for(row=1;row&lt;11;row++)
          {
              for(column=0; column &lt; row; column++){
                  System.out.print("*");
              }
              System.out.println("");
          }
  
        // second triangle
        /* Write code to display the second triangle. */
          System.out.print("\n");
  
          for(row=10;row&gt;0;row--)
          {
              for(column=0; column &lt; row; column++){
                  System.out.print("*");
              }
              System.out.println("");
  
          }
  
  
        // third triangle
        /* Write code to display the third triangle. The outer for loop should
           contain two separate inner for loops--one to display spaces and one to
           display asterisks. */
           System.out.print("\n");
  
          for(row=10; row &gt; 0; row--)
          {
              for(column=0; column &lt; row; column++){
                  System.out.print("*");
              }
              System.out.println("");
  
  
          }
  
        // fourth triangle
        /* Write code to display the fourth triangle using techniques similar to
           the third triangle. */
  
          for(row=1;row&lt;11;row++)
          {
              for(column=0; column &lt; row; column++){
                  System.out.print("*");
              }
              System.out.println("");
          }
  
  
     } // end main
  } // end class Triangles
  </code></pre>
  
  <p>Once that code is outputted it prints: </p>
  
  <pre><code>*
  **
  ***
  ****
  *****
  ******
  *******
  ********
  *********
  **********
  
  **********
  *********
  ********
  *******
  ******
  *****
  ****
  ***
  **
  *
  
  **********
  *********
  ********
  *******
  ******
  *****
  ****
  ***
  **
  *
  
  *
  **
  ***
  ****
  *****
  ******
  *******
  ********
  *********
  **********
  </code></pre>
  
  <p>instead of this I need this to print: </p>
  
  <pre><code>*
  **
  ***
  ****
  *****
  ******
  *******
  ********
  *********
  **********
  
  **********
  *********
  ********
  *******
  ******
  *****
  ****
  ***
  **
  *
  
  **********
   *********
    ********
     *******
      ******
       *****
        ****
         ***
          **
           *
  
           *
          **
         ***
        ****
       *****
      ******
     *******
    ********
   *********
  **********
  </code></pre>
  
  <p>I just want to know how to print spaces to place in the rows that I need to place them. Do I need to use an if statement or another for statement? Thank you for helping me in advance</p>