print pyramid c#
Console.WriteLine("sharing prymid length:");
var prymaidlength = Console.ReadLine();
bool isnumeric = double.TryParse(prymaidlength, out double n);
if (isnumeric)
{
//print prymaid numbers
for (int i = 1; i <= double.Parse(prymaidlength); i++)
{
//number of spaces before printing number - (total size / 2) - 1
for (int j = 1; j <= (double.Parse(prymaidlength)-i); j++)
{
Console.Write(" ");
}
for (int k = 1; k <= i; k++)
{
Console.Write(k.ToString());
}
for (int k = i-1; k >= 1; k--)
{
Console.Write(k.ToString());
}
Console.WriteLine();
}
}
Console.ReadLine();