Given an integer N, the task is to print first N integers whose sum of digits is 10.
Input: N = 4
Output: 19 28 37 46
Input: N = 6
Output: 19 28 37 46 55 64
Approach: Initialise num = 19 to get the first number of the series, now add 9 to the previous number and check whether the sum of the digits of the new number is 10. If yes then this is the next number of the series, this is because the difference between any two consecutive numbers of the required series is at least 9.
Below is the implementation of the above approach:
19 28 37 46 55 64 73 82 91
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Check if the sum of distinct digits of two integers are equal
- Find the number of integers from 1 to n which contains digits 0's and 1's only
- Find any K distinct odd integers such that there sum is equal to N
- Find three integers less than or equal to N such that their LCM is maximum
- Find a number x such that sum of x and its digits is equal to given n.
- Find a Number X whose sum with its digits is equal to N
- Find maximum product of digits among numbers less than or equal to N
- Numbers with sum of digits equal to the sum of digits of its all prime factor
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count of integers of length N and value less than K such that they contain digits only from the given set
- Number of n-digits non-decreasing integers
- Number of integers in a range [L, R] which are divisible by exactly K of it's digits
- Count positive integers with 0 as a digit and maximum 'd' digits
- Remove two consecutive integers from 1 to N to make sum equal to S
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.