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 range 1 to N which are divisible by X but not by Y
- Count the numbers divisible by 'M' in a given range
- 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 n digit numbers divisible by given number
- Count natural numbers whose factorials are divisible by x but not y
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.
Improved By : jit_t