Maximum number on 7 | Function to find the maximum number that can be displayed using the N segments ; Condition to check base case ; Condition to check if the number is even ; Condition to check if the number is odd ; Driver Code
function segments ( n ) { if ( n == 1 n == 0 ) { return ; } if ( n % 2 == 0 ) { document . write ( " " ) ; segments ( n - 2 ) ; } else if ( n % 2 == 1 ) { document . write ( " " ) ; segments ( n - 3 ) ; } } let n ; n = 11 ; segments ( n ) ;