114. C Program to Print Number Triangle.
How does this program work?
- This Program is used to print the number triangle from the given pattern.
Here is the code
int main()
{
int i, j;
for (i=0;i< 6;i++)
{
for(j=6;j>i;j--)
{
printf(" ");
}
for(j=0;j<=i;j++)
{
printf("%ld ",fact(i)/(fact(j)*fact(i-j)));
}
printf("\n");
}
return 0;
}
long fact(int n)
{
int i;
long f= 1;
for(i=1;i<=n;i++)
f = f*i;
return f;
}