public static void Main()
Console.OutputEncoding = Encoding.UTF8;
Console.Write("Enter height of the triangle: ");
triangleHeight = byte.Parse(Console.ReadLine());
} while (triangleHeight <= 2);
int numberSymbolsBase = triangleHeight;
if (triangleHeight * 2 > Console.BufferWidth || triangleHeight > Console.BufferHeight)
Console.SetBufferSize(2 * triangleHeight, triangleHeight + 5);
string spacesBeforeEdge = new string(' ', triangleHeight - 1);
string edge = spacesBeforeEdge + symbol;
int spacesBetweenCount = 1;
int spacesBeforeCount = triangleHeight - 2;
for (int i = 1; i <= triangleHeight - 2; i++)
string spacesBefore = new string(' ', spacesBeforeCount);
string spacesBetween = new string(' ', spacesBetweenCount);
spacesBetweenCount = spacesBetweenCount + 2;
string currentLine = spacesBefore + symbol + spacesBetween + symbol;
Console.WriteLine(currentLine);
for (int i = 1; i <= numberSymbolsBase; i++)
Console.Write(symbol + " ");
Console.WriteLine("Wrong format for height."); ;
catch (OverflowException)
Console.WriteLine("You have entered too big or negative number for height.");