Smallest odd number with N digits | C ++ implementation of the above approach ; Function to return smallest odd with n digits ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int smallestOdd ( int n ) { if ( n == 1 ) return 1 ; return pow ( 10 , n - 1 ) + 1 ; } int main ( ) { int n = 4 ; cout << smallestOdd ( n ) ; return 0 ; }