text: Program to print modified Binary triangle pattern | C # implementation to print the modified binary triangle pattern ; Function to print the modified binary pattern ; Loop to traverse the rows ; Loop to traverse the numbers in each row ; Check if j is 1 or i In either case print 1 ; Else print 0 ; Change the cursor to next line after each row ; Driver Code ; Function call
code: using System ; class GFG { static void modifiedBinaryPattern ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= i ; j ++ ) { if ( j == 1 j == i ) Console . Write ( 1 ) ; else Console . Write ( 0 ) ; } Console . WriteLine ( ) ; } } public static void Main ( ) { int n = 7 ; modifiedBinaryPattern ( n ) ; } }