# C program to print pascal triangle devquora

Posted On: Dec 23, 2020 ### Overview:

First of all in this article, I will give you the general introduction of Pascal Triangle. Then, I will write c program to print pascal triangle. After all, I will show its output as a pascal triangle in front of you.

### What is Pascal’s Triangle?

Pascal’s triangle, in algebra, a triangular arrangement of numbers that gives the coefficients in the expansion of any binomial expression, such as (x + y)n. It is named for the 17th-century French mathematician Blaise Pascal.

To find nth term of a pascal triangle we use following formula. ### Demonstration of Pascal Triangle ### C program to print pascal triangle

```#include <stdio.h>

/* Function definition */
long long fact(int n);

int main()
{
int n, k, row, i;
long long term;

/* Input number of rows */
printf("Enter number of rows : ");
scanf("%d", &row);

for(n=0; n<row; n++)
{
/* Prints 3 spaces */
for(i=n; i<=row; i++)
printf("%3c", ' ');

/* Generate term for current row */
for(k=0; k<=n; k++)
{
term = fact(n) / (fact(k) * fact(n-k));

printf("%6lld", term);
}

printf("\n");
}

return 0;
}

/**Function to calculate factorial */
long long fact(int n)
{
long long factorial = 1ll;
while(n>=1)
{
factorial *= n;
n--;
}

return factorial;
}
``` Conclusion:

Pascal Triangle is named as the Mathematician Blaise Pascal. This Program shows a Pascal Triangle in front of you as a output.

Never Miss an Articles from us.

## Related Articles

#### C Program to convert Decimal to Binary Number

A Decimal Number is constructed with any digit from 0 to 9. For instance, 24 is a Decimal Number constructed from the digits 2 and 4. A Binary Number is constructed with digits 0 and 1. For instance, ..

#### C program to reverse a string

This program reversed the entered string that means opposite of the previous string sequence...

#### C program to reverse an Integer number

Are you want a demonstration of The C Program that reverses an Integer number? This Program reversing the sequence of digits in an Integer. After the successful compilation of the program, a message..