Input: N = 10
The number with zeros are 0, 10 till 10. Hence the count of zeros is 2.
Input: N = 20
The number with zeros are 0, 10, 20 till 20. Hence the count of zeros is 3.
- Iterate from 0 to N.
- For each number do the following:
- Store the above number in a variable temp.
- For each digit in temp, if the digit is zero then increment the zero count by 1.
- Print the count of zeros calculated in the above steps.
Below is the implementation of the above approach:
Time Complexity: O(N)
Auxiliary Space: O(1)
- C program to count zeros and ones in binary representation of a number
- Smallest number divisible by n and has at-least k trailing zeros
- Check if any permutation of a number without any leading zeros is a power of 2 or not
- Remove leading zeros from an array
- All possible numbers of N digits and base B without leading zeros
- Sum of all elements in an array between zeros
- Program to count number of distinct Squares and Cubes upto N
- C program to count number of vowels and consonants in a String
- C program to Count the digits of a number
- Find count of digits in a number that divide the number
- Count Number of animals in a zoo from given number of head and legs
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count the number of occurrences of a particular digit in a number
- Find smallest possible Number from a given large Number with same count of digits
- Count of prime digits of a Number which divides the number
- Program to check whether the given number is Buzz Number or not
- Check if count of Alphabets and count of Numbers are equal in the given String
- Check if count of even divisors of N is equal to count of odd divisors
- Program to count vowels in a string (Iterative and Recursive)
- Program to Count numbers on fingers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.