Count all possible N digit numbers that satisfy the given condition | C ++ implementation of above approach ; Function to return the count of required numbers ; If N is odd then return 0 ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; string getCount ( int N ) { if ( N % 2 == 1 ) return 0 ; string result = "9" ; for ( int i = 1 ; i <= N / 2 - 1 ; i ++ ) result += "0" ; return result ; } int main ( ) { int N = 4 ; cout << getCount ( N ) ; return 0 ; }