2
06/11/2024 7:07 pm
Topic starter
I need to create a Christmas Tree (pinetree) for my project in C#.... by using 10 stars
It must be 10 * high (*<-- this is a strar 🙂
Must look like this:

Can you please help me! Thanks!
1 Answer
2
06/11/2024 7:08 pm
Here's one - just copy-paste it in your Visual Studio or whatever IDE you are using to see it in colors:
using System;
class ChristmasTree
{
static void Main()
{
int spaces = 10;
int asterix = 1;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < spaces; j++)
{
Console.Write(" ");
}
for (int j = 0; j < asterix; j++)
{
Console.Write("* ");
}
Console.WriteLine();
asterix++;
spaces--;
}
}
}
