#include <stdio.h>
int main()
{
int co=1,rows = 6;
for(int i = 0; i < rows; i++)
{
for(int space = 1; space < rows - i; ++space)
{
printf(" ");
}
for(int j = 0; j <= i; j++)
{
if (j == 0 || i == 0)
co = 1;
else
co = co * (i - j + 1) / j;
printf("%4d", co);
}
printf("\n");
}
}
C# program
using System;
public class Program
{
public static void Main()
{
int row, i, j, k;
row = 5;
for (i = 0; i <= row; i++)
{
k = 1;
for (j = i; j <= row - 1; j++)
Console.Write(" ");
for (j = 0; j <= i; j++)
{
Console.Write("{0} ", k);
k = (k * (i - j) / (j + 1));
}
Console.WriteLine();
}
Console.ReadLine();
}
}
JAVA
Python
C program
C# program
PHP Program
need an explanation for this answer? contact us directly to get an explanation for this answer