Largest Even and Odd N | Java implementation of the approach ; Function to print the largest n - digit even and odd numbers in hexadecimal number system ; Append ' F ' ( N - 1 ) times ; Append ' E ' for an even number ; Append ' F ' for an odd number ; Driver code
class GFG { static void findNumbers ( int n ) { String ans = string ( n - 1 , ' F ' ) ; String even = ans + ' E ' ; String odd = ans + ' F ' ; System . out . print ( " Even : ▁ " + even + "NEW_LINE"); System . out . print ( " Odd : ▁ " + odd + "NEW_LINE"); } private static String string ( int n , char c ) { String str = " " ; for ( int i = 0 ; i < n ; i ++ ) str += c ; return str ; } public static void main ( String [ ] args ) { int n = 2 ; findNumbers ( n ) ; } }