Create a C# program that asks the user for text and draws a pyramid on the screen.
public class DrawTriangle
public static void Main(string args)
string text = Console.ReadLine();
if (text.Length % 2 == 0)
text += " ";
int position = text.Length / 2;
int rows = text.Length / 2 + 1;
int amount = 1;
for (int i = 0; i < rows; i++)
for (int j = 0; j < position; j++)
amount += 2;
Practice C# anywhere with the free app for Android devices.
Learn C# at your own pace, the exercises are ordered by difficulty.
Own and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.