title: printing pyramid pattern with asterisks
body: <p>I need to write a code for pyramid pattern with asterisks. yeah, it sounds like the codes on everywhere. but, i need to make a pyramid with a number of asterisks, not a number of rows. </p>
  
  <p>for example, if user gave 9, then need to print a pyramid until the asterisks runs out. It should be center pyramids.</p>
  
  <p>I've tried with the number of rows. but i have no idea how to print with the number of asterisks. while loop could be my answer, but i'm not sure..</p>
  
  <pre class="lang-java prettyprint-override"><code>    public static void main(String args[]) {
          int n = 5; // number of rows
  
          for (int i = 0; i &lt; n; i++)
          {
              for (int j = n - i; j &gt; 1; j--)
              {
                  System.out.print(" ");
              }
              for (int j = 0; j &lt;= i; j++)
              {
                  System.out.print("* ");
              }
  
              System.out.println();
          }
      }
  </code></pre>
  
  <p>the result should be like this, but without space between asterisks..</p>
  
  <pre><code>    *   
     * *  
    * * * 
   * * * *
  * * * * *
  </code></pre>
  
  <p>my output is showing exactly same thing, but i'm using a number of rows, not number of asterisks.</p>