Hello, I’m working on this task:
Write a program that reads an integer count from the console. Then it should output a triangle composed of ‘#’ symbols starting from 1 in the first row and ending with count in the last row. This time, use the while loop. For example:
>4
Here is my code:
namespace WhileLoop
{
class TriangleWhile
{
static void Main(string[] args)
{
int count = int.Parse(Console.ReadLine());
int i = 0;
while (i++ < count)
{
int j = 0;
while (j < count)
{
Console.Write("#");
j++;
}
Console.WriteLine();
}
}
}
}
Can anyone please help me to solve it?