First off, that won't work because you need to explicitly say when you have reached the end of a line: call
Console.WriteLine
between the lines to "break" them in the output.
And remember that C# is case sensitive:
console.write
is not the same as
Console.Write
This is your homework, so I'm not going to give you the code! But a few hints isn;t a problem:
You can't really do that in a "single loop" - you need two loops as a minimum: One to print each line, and one to print the contents of that line. That is, assuming you have to be flexible and allow for other values than 5 as the number of characters wide the lines should be. If not, it's trivial, and you don't need a loop:
Console.WriteLine("12345");
Console.WriteLine(" 234 ");
Console.WriteLine(" 3 ");
But submitting that won't get you a good grade! :laugh:
What you actually want to do is have two loops, one inside the other.
The outer loop writes each line:
for (int i = 0; i < numberOfLines; i++)
{
...
Console.WriteLine();
}
And inside that you have a second loop which writes the line.
That's actually pretty easy: all you need to do is loop for the number of characters on the line minus the line number, and check the loop index. If it's less than the line number, print a space. Otherwise, print the index value plus one.
Try it: you'll see what I mean!