text: Print Triangle separated pattern | C # program to print the triangle separated pattern using star and slash character ; Function to print pattern recursively ; Base Case ; Conditions to print slash ; Condition to print forword slash ; Condition to print backward slash ; Else print ' * ' ; Recursive call for rows ; Recursive call for changing the rows ; Driver Code ; Function Call
code: using System ; class GFG { static int printPattern ( int i , int j , int n ) { if ( j >= n ) { return 0 ; } if ( i >= n ) { return 1 ; } if ( j == i j == n - 1 - i ) { if ( i == n - 1 - j ) { Console . Write ( " / " ) ; } else { Console . Write ( " \ \" ) ; } } else { Console . Write ( " * " ) ; } if ( printPattern ( i , j + 1 , n ) == 1 ) { return 1 ; } Console . WriteLine ( ) ; return printPattern ( i + 1 , 0 , n ) ; } public static void Main ( String [ ] args ) { int N = 9 ; printPattern ( 0 , 0 , N ) ; } }