text: Pascal 's Triangle | C program for Pascals Triangle A O ( n ^ 2 ) time and O ( 1 ) extra space function for Pascal 's Triangle ; used to represent C ( line , i ) ; The first value in a line is always 1 ; Driver code
code: void printPascal ( int n ) { for ( int line = 1 ; line <= n ; line ++ ) { int C = 1 ; for ( int i = 1 ; i <= line ; i ++ ) { printf ( " % d ▁ " , C ) ; C = C * ( line - i ) / i ; } printf ( " STRNEWLINE " ) ; } } int main ( ) { int n = 5 ; printPascal ( n ) ; return 0 ; }