Given a number . The task is to print the multiples of the unit digit of N from the unit digit of N to N.
Note: If the unit digit is 0 then print the multiples of 10.
Input : 39 Output : 9 18 27 36 Explanation : The unit digit of 39 is 9. So the multiples of 9 between 9 and 39 are: 9, 18, 27, 36 Input : 25 Output : 5 10 15 20 25
- Find the unit digit of the input number. Unit digit of N will be (N%10), i.e. remainder upon dividing N by 10.
- Check if the unit digit is 0.
- If yes then consider the multiple as 10.
- Print the multiples of unit digit until it is less than or equal to the input number.
Below is the implementation of the above approach:
9 18 27 36
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Count numbers with unit digit k in given range
- Generate a number such that the frequency of each digit is digit times the frequency in given number
- Minimum N-Digit number required to obtain largest N-digit number after performing given operations
- Nth number in a set of multiples of A , B or C
- Maximum number of multiples in an array before any element
- Perform n steps to convert every digit of a number in the format [count][digit]
- Count of Numbers in Range where first digit is equal to last digit of the number
- Find Multiples of 2 or 3 or 5 less than or equal to N
- Rearrange all elements of array which are multiples of x in increasing order
- Find the sum of all multiples of 2 and 5 below N
- Rearrange all elements of array which are multiples of x in decreasing order
- Sort elements of the array that occurs in between multiples of K
- Count of Multiples of A ,B or C less than or equal to N
- Find numbers which are multiples of first array and factors of second array
- Count of multiples in an Array before every element
- Count integers in an Array which are multiples their bits counts
- Generate first K multiples of N using Bitwise operators
- Program to print the given digit in words
- Difference between Horizontal and Vertical micro-programmed Control Unit
- Python Program to print digit pattern
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.