Q:

How to draw a square

I'm having troubles drawing the following square:
* # # # # # 
* * # # # # 
* * * # # # 
* * * * # # 
* * * * * # 
* * * * * *

This is the method I wrote but it isn't working as it should be:
public void Draw(int width){
    char asterisk = '*';
    char hash = '#';
    int counter = 0;
    for (int h = 0; h < 6; h++) { //height?
        for (int w = 0; w < width; w++) {
            if (h == counter)
                Console.Write (asterisk);
            else
                Console.Write (hash);
        }
        counter++;

        Console.WriteLine ();
    }
    Console.WriteLine ();
}

Any suggestions on what I should be doing?
I know that when it's the first row it should draw only a single asterisk, when it's the second row two asterisks and so on and so forth, but I really don't know how to do that.. Help please.

A:

Instead of using a counter value, you can just change your criteria from if (h == counter) to if (h >= w).

A:

Change h == counter with w <= counter
Furthermore you can drop the counter, since it is always equal to h

A:

This lesson is intended to teach a student to use nested loops, and to understand that each instance of the inner loop can access the state of the outer loop. Unfortunately most teachers don't understand what the heck they're teaching and just give you the problem without explaining why it's a useful thing to practice.
Because you always want the exact same number of stars as the row you are on, you should just compare directly between the column index and the current row. 
public void DrawSquare(int sideLength)
{
  for(int row = 1; row <= sideLength; row++)
  {
     for (int col = 1; col <= sideLength; col++)
     {
       if (col <= row) 
         Console.Write('*');
       else
         Console.Write('#');
     }
     Console.WriteLine();
  }
}

There are many shortcuts and c# tricks that could get you there faster, but this is the essence of what you should be trying to do. 

