title: C# Patterns;for loops
body: <p>Develop a C# console application that displays the following pattern. Use for loops (hint:  nested) to generate the patterns. All asterisks should be displayed by a single statement of the form <code>Console.Write("*");</code> which displays the asterisks leading up to the number value shown in the example. Note the sequence of each number in turn. You will need to deduce how the numbers are computed (they are the result of a computation) and where that computation will be placed in the loop structures.  You may not hardcode the displayed numbers into your loops.</p>
  
  <p>I already have the "*" but can't figure out the numbers.</p>
  
  <p>The two patterns should look similar to the following:</p>
  
  <pre><code>*2
  **4
  ***6
  ****8
  *****10
  ******12
  *******14
  ********16
  *********18
  **********20
  
  {
          for (int row = 0; row &lt; 10; row++)            
              {
                  Console.Write("  ");
  
                  for (int col = 0; col &lt;= row; col++)
                  {
                      Console.Write("*");
                      Console.Write(" ");
                  }
                  Console.WriteLine(" ");
              }
          Console.WriteLine(" ");
  
          for (int row = 0; row &lt; 10; row++)
          {
              Console.Write("  ");
  
              for (int col = 10; col &gt; row; col--)
              {
                  Console.Write("*");
                  Console.Write(" ");
              }
              Console.WriteLine(" ");
          }
  
      }
  
  }
  </code></pre>
  
  <p>}</p>