In this section you will see C Program to display Pascal’s Triangle.
Pascal’s triangle is the triangular arrangement of binomial coefficient. It is an infinite collection of entries in an equilateral triangle form and is named after French mathematician, Blaise Pascal (1623 – 1662).
Now lets see the C Program to display Pascal’s Triangle.
C Program
/* Program :Printing Pascal's triangle */ #include <stdio.h> int main() { int a[15][15],i,j, rows, p=25, k; printf("\nEnter the number of rows display : "); scanf("%d", &rows); for(i=0;i<rows;i++) { for(j=p-2*i;j>=0;j--) printf(" "); for(j=0;j<=i;j++) { if(j==0||i==j) a[i][j] =1; else a[i][j] = a[i-1][j-1]+a[i-1][j]; printf("%4d",a[i][j]); } printf("\n"); } return 0; }
Output:-
Conclusion
In this articles you have successfully seen the C program of how to display the pascal triangle.
I hope you have successfully understood the program and If you have any doubt please do ask in the comment section.
Amazing article! Thank you so much