I am new here and also new to C# in general. I have as a task to output the letter O. Furthermore, the program should read a number that means the corresponding height.
The output should look like the given photo illustrates.
If the number is now larger, the object should be adjusted in width accordingly. And this is now my problem. I already have a code block, which outputs this above constellation, but is not customizable. I have already tried using WriteLine and if statements to scale a width with spaces, but that doesn't work the way I want it to. In addition, the convert is still missing at the beginning, which introduces the entered number.
So what I want:
- you should enter a number that defines the height.
- the output should be adjusted to the height and scaled logically
- no more lines should be added that contain the #, it should only be the total of 8 "#" (stretched, you could say)
My code so far is:
class Program
{
static void Main(string[] args)
{
for (int i = 0; i <= 7; i++)
if (i == 0)
Console.WriteLine(" #");
for (int j = 1; j <= 7; j++)
if (j == 1)
Console.WriteLine(" # #");
for (int k = 2; k <= 7; k++)
if (k == 2)
Console.WriteLine("# #");
for (int m = 3; m <= 7; m++)
if (m == 3)
Console.WriteLine(" # #");
for (int m = 4; m <= 7; m++)
if (m == 4)
Console.WriteLine(" #");
Console.ReadKey();
}
}