text: Pascal 's Triangle | C # program for Pascal ' s ▁ Triangle ▁ A ▁ O ( n ^ 2 ) ▁ time ▁ and ▁ O ( 1 ) ▁ extra ▁ space ▁ method ▁ for ▁ Pascal ' s Triangle ; used to represent C ( line , i ) ; The first value in a line is always 1 ; Driver code
code: using System ; class GFG { public static void printPascal ( int n ) { for ( int line = 1 ; line <= n ; line ++ ) { int C = 1 ; for ( int i = 1 ; i <= line ; i ++ ) { Console . Write ( C + " ▁ " ) ; C = C * ( line - i ) / i ; } Console . Write ( " STRNEWLINE " ) ; } } public static void Main ( ) { int n = 5 ; printPascal ( n ) ; } }