Given an integer num, the task is to count the number of holes in that number. The holes in each digit are given below:
|Digit||Number of Holes|
Input: num = 6457819
Input: num = 2537312
Approach: Initialize holes = 0 and an array hole with the values given where hole[i] stores the number of holes in the digit i. Now, for every digit d in num update holes = holes + hole[d]. Print the holes in the end.
Below is the implementation of the above approach:
- Count even and odd digits in an Integer
- Program to count digits in an integer (4 Different Methods)
- Count the minimum steps to reach 0 from the given integer N
- Minimum positive integer to divide a number such that the result is an odd
- Find smallest possible Number from a given large Number with same count of digits
- Count Number of animals in a zoo from given number of head and legs
- Find count of digits in a number that divide the number
- Count of prime digits of a Number which divides the number
- Count the number of occurrences of a particular digit in a number
- Count Hexadecimal Number
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count of Prime digits in a Number
- Count number of even and odd elements in an array
- C program to Count the digits of a number
- Count digits in given number N which divide N
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.