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 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 of all even numbers in the range [L, R] whose sum of digits is divisible by 3
- Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime
- Total numbers with no repeated digits in a range
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count numbers with same first and last digits
- Count of numbers having only 1 set bit in the range [0, n]
- Count Odd and Even numbers in a range from L to R
- Count numbers formed by given two digit with sum having given digits
- Count Numbers with N digits which consists of even number of 0’s
- Count of N-digit numbers with all distinct digits
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