Largest Even and Odd N | C ++ implementation of the approach ; Function to print the largest n - digit even and odd numbers in octal number system ; Append '7' ( N - 1 ) times ; Append '6' for an even number ; Append '7' for an odd number ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findNumbers ( int n ) { string ans = string ( n - 1 , '7' ) ; string even = ans + '6' ; string odd = ans + '7' ; cout << " Even ▁ : ▁ " << even << endl ; cout << " Odd ▁ : ▁ " << odd << endl ; } int main ( ) { int n = 4 ; findNumbers ( n ) ; return 0 ; }