Given a number **N**. The task is to find the count of numbers which have N digits and even number of zeroes.

**Note: **The number can have preceding 0’s.

**Examples**:

Input: N = 2Output: Count = 81 Total 2 digit numbers are 99 considering 1 as 01. 2 digit numbers are 01, 02, 03, 04, 05.... 99 Numbers with odd 0's are 01, 02, 03, 04, 05, 06, 07, 08, 09 10, 20, 30, 40, 50, 70, 80, 90 i.e. 18 The rest of the numbers between 01 and 99 will do not have any zeroes and zero is also an even number. So, numbers with even 0's are 99 - 18 = 81.Input: N = 3Output: Count = 755

**Approach:** The idea is to find the Count Numbers with N digits which consists of odd number of 0’s and subtract it from the total number with N digits to get the number with even 0’s.

## C++

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

*chevron_right*

*filter_none*

## Java

`// Java program to count numbers ` `// with N digits which consists ` `// of odd number of 0's ` `import` `java.lang.*; ` `import` `java.util.*; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to count Numbers with ` `// N digits which consists of odd ` `// number of 0's ` `static` `double` `countNumbers(` `int` `N) ` `{ ` ` ` `return` `(Math.pow(` `10` `, N) - ` `1` `) - ` ` ` `(Math.pow(` `10` `, N) - ` ` ` `Math.pow(` `8` `, N)) / ` `2` `; ` `} ` ` ` `// Driver code ` `static` `public` `void` `main (String args[]) ` `{ ` ` ` `int` `n = ` `2` `; ` ` ` `System.out.println(countNumbers(n)); ` `} ` `} ` ` ` `// This code si contributed ` `// by Akanksha Rai ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 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 ` `def` `countNumber(n): ` ` ` ` ` `return` `(` `pow` `(` `10` `,n)` `-` `1` `)` `-` `(` `pow` `(` `10` `,n)` `-` `pow` `(` `8` `,n))` `/` `/` `2` ` ` ` ` `# Driver code ` `n ` `=` `2` `print` `(countNumber(n)) ` ` ` `# This code is contributed by Shrikant13 ` |

*chevron_right*

*filter_none*

## C#

`// C# program to count numbers ` `// with N digits which consists ` `// of odd number of 0's ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to count Numbers with ` `// N digits which consists of odd ` `// number of 0's ` `static` `double` `countNumbers(` `int` `N) ` `{ ` ` ` `return` `(Math.Pow(10, N) - 1) - ` ` ` `(Math.Pow(10, N) - ` ` ` `Math.Pow(8, N)) / 2; ` `} ` ` ` `// Driver code ` `static` `public` `void` `Main () ` `{ ` ` ` `int` `n = 2; ` ` ` `Console.WriteLine(countNumbers(n)); ` `} ` `} ` ` ` `// This code si contributed by ajit ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP 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 ` `function` `countNumbers(` `$N` `) ` `{ ` ` ` `return` `(pow(10, ` `$N` `) - 1) - ` ` ` `(pow(10, ` `$N` `) - pow(8, ` `$N` `)) / 2; ` `} ` ` ` `// Driver code ` `$n` `= 2; ` `echo` `countNumbers(` `$n` `),` `"\n"` `; ` ` ` `// This code is contributed by akt_mit ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

81

**Note**: Answer can be very large, so for N greater than 9, use modular exponentiation.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Count Numbers with N digits which consists of odd number of 0's
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count of subsequences which consists exactly K prime numbers
- Smallest multiple of 3 which consists of three given non-zero digits
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Number formed by deleting digits such that sum of the digits becomes even and the number odd
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Numbers of Length N having digits A and B and whose sum of digits contain only digits A and B
- Check if a number has an odd count of odd divisors and even count of even divisors
- Count total number of N digit numbers such that the difference between sum of even and odd digits is 1
- Smallest integer greater than n such that it consists of digit m exactly k times
- Modify array by merging elements with addition such that it consists of only Primes.
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- Sum of the digits of square of the given number which has only 1's as its digits
- Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime
- Count of all even numbers in the range [L, R] whose sum of digits is divisible by 3
- Count of numbers upto N digits formed using digits 0 to K-1 without any adjacent 0s
- Count of prime digits of a Number which divides the number
- Minimum digits to be removed to make either all digits or alternating digits same

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.