Here i put the logic of printing such type of pyramid may be some syntax error but it will print your desired pyramid of number
//first loop for number or row in your example 4
int num = 4;
int counter = 1;
int counterspace = 0;
for(int i=0; i<num; i++)
{
//2nd loop for print preceding space
for(int j=num - i; j>0; j--)
{
Console.Write(" ");
}
//3rd loop for print number
counterspace = 1;
for(int k = 0; k<= i; k++)
{
//here print number with space with proper sapce
if((counterspace/2) > 0)
{
Console.Write(counter);
counter++;
}
else
{
Console.Write(" ");
}
}
}
output as
1
2 3
4 5 6
7 8 9 10