Given a range l – r (inclusive), count the numbers that are divisible by all of its non-zero digits.
Input : 1 9 Output : 9 Explanation: all the numbers are divisible by their digits in the range 1-9. Input : 10 20 Output : 5 Explanation: 10, 11, 12, 15, 20
1. Run a loop to generate every number from l and r.
2. Check if every non-zero digit of that number divides the number or not.
3. Keep a count of all numbers that are completely divisible by its digits.
4. Print the count of numbers.
Below is the implementation of the above approach:
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Count of all even numbers in the range [L, R] whose sum of digits is divisible by 3
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Count the numbers divisible by 'M' in a given range
- Count numbers in range 1 to N which are divisible by X but not by Y
- Count of numbers from range [L, R] whose sum of digits is Y
- Count of Numbers in Range where the number does not contain more than K non zero digits
- Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime
- Sum of all numbers divisible by 6 in a given range
- Numbers that are not divisible by any number in the range [2, 10]
- N digit numbers divisible by 5 formed from the M digits
- Count integers in a range which are divisible by their euler totient value
- Total numbers with no repeated digits in a range
- Count numbers with same first and last digits
- Count pairs of numbers from 1 to N with Product divisible by their Sum
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.
Improved By : jit_t