#include<stdio.h> #include<conio.h> long fact(int); void main() { clrscr(); int i, n, c; printf("Upto how many line (Enter number of rows) : "); scanf("%d",&n); for(i=0; i<n; i++) { for(c=0; c<=(n-i-2); c++) { printf(" "); } for(c=0; c<=i; c++) { printf("%ld ",fact(i)/(fact(c)*fact(i-c))); } printf("\n"); } getch(); } long fact(int n) { int c; long res=1; for(c=1; c<=n; c++) { res = res*c; } return (res); }
C program to print Pascal Triangle.
Reviewed by
on
December 22, 2019
Rating:
No comments: