private static int[][] GetPyramidMatrix(int height)
int[][] arr = new int[height][];
for (int i = 0; i < height; i++)
for (int k = 0; k < size; k++)
private static int CountOfDigits(int number)
return (int)Math.Floor(Math.Log10(number) + 1);
private static void DisplayPyramid(int[][] arr)
int width = arr[height - 1].Length;
int maxValue = arr.SelectMany(x => x).Max();
int maxCountOfDigit = CountOfDigits(maxValue);
string spaceFormat = new string(' ', maxCountOfDigit + 1);
for (int i = 0; i < height; i++)
for (int j = 0; j < indent; j++)
Console.Write(spaceFormat);
for (int k = 0; k < arr[i].Length; k++)
int curCountOfDigit = CountOfDigits(arr[i][k]);
string curSpaceFormat = new string(' ', maxCountOfDigit - curCountOfDigit);
Console.Write(string.Format("{0} " + curSpaceFormat, arr[i][k]));
public static void BuildPyramid(int height)
int[][] arr = GetPyramidMatrix(height);
int pyramidWidth = arr[height - 1].Length;
int right = pyramidWidth;
for (int i = left; i < right; ++i)
for (int i = bottom - 1, side = right - 1; i >= top; --i)
for (int i = top + 1; i < bottom; ++i)
int col = arr[row].Length / 2;
public static void Main()
Console.WriteLine("UniLecs");