Count Numbers with N digits which consists of even number of 0 ’ s | C ++ program to count numbers with N digits which consists of odd number of 0 's ; Function to count Numbers with N digits which consists of odd number of 0 's ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int countNumbers ( int N ) { return ( pow ( 10 , N ) - 1 ) - ( pow ( 10 , N ) - pow ( 8 , N ) ) / 2 ; } int main ( ) { int n = 2 ; cout << countNumbers ( n ) << endl ; return 0 ; }