title: Pascal's triangle without using arrays (only loops)
body: <p>I am trying to output Pascal's triangle with asterisks (*). This is my code:</p>
  
  <pre><code>public static void main(String [] arg)
  {
      int n=3;
      for(int i=0;i&lt;n;i++)
      {
          for(int j=0;j&lt;n-i;j++)
          {
              System.out.print(" ");
          }
          boolean b=true;
          for(int k=0;k&lt;i*2+1;k++)
          {
              if(b)
              {
                  System.out.print("*");
                  b=false;
              }
              else
              {
                  System.out.print(" ");
                  b=true;
              }
  
          }
      }
      System.out.println(" ");
  }
  }
  </code></pre>
  
  <p>I have rechecked several times and failed to find any error.
  Also let me know whether the if-block is implemented correctly.
  The following code is not giving the required output as below:   </p>
  
  <pre><code>     *  
     *   *  
  *    *    * 
  </code></pre>