Given a range [L, R], the task is to find the count of numbers from the range whose last digit is either 2, 3 or 9.
Input: L = 1, R = 3
2 and 3 are the only valid numbers.
Input: L = 11, R = 33
Approach: Initialize a counter count = 0 and run a loop for every element from the range, if the current element ends with any of the given digits then increment the count.
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 numbers in given range such that sum of even digits is greater than sum of odd digits
- Count of numbers from range [L, R] whose sum of digits is Y
- Count of numbers with all digits same in a given range
- Count of all even numbers in the range [L, R] whose sum of digits is divisible by 3
- Count numbers in range L-R that are divisible by all of its non-zero digits
- 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
- Count all prime numbers in a given range whose sum of digits is also prime
- Count of numbers upto N digits formed using digits 0 to K-1 without any adjacent 0s
- Total numbers with no repeated digits in a range
- Cumulative product of digits of all numbers in the given range
- Find all the possible numbers in a range that can be evenly divided by its digits
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Print all numbers in given range having digits in strictly increasing order
- Count numbers with same first and last digits
- Count Odd and Even numbers in a range from L to R
- Count of numbers having only 1 set bit in the range [0, n]
- Count of N-digit numbers with all distinct digits
- Count different numbers possible using all the digits their frequency times
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 : AnkitRai01