title: how can I draw a triangle of asterisks using the while statement?
body: <p>here is the (not working code) and it should print the shape below but its not :</p>
  
  <pre><code>static void Main(string[] args)
  {
      int i = 1;
      int k = 5;
      int h = 1;
  
      while (i &lt;= 5)
      {
          Console.WriteLine("");
          while (k &gt; i)
          {
              Console.Write(" ");
              k--;
          }
          while (h &lt;= i)
          {
              Console.Write("**");
              h++;
          }
          i++;
      }
      Console.ReadLine();
  
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/0Gbf6.png" alt="Screenshot"></p>
  
  <p>but when I try to do the same using the while statement the shape gets totally messed up.</p>
  
  <p>any help ?</p>