 Challenge[unsolved] HELP | Sololearn: Learn to code for FREE!

+3

Challenge[unsolved] HELP

For a input n find the smallest number whose sum of digits is n and is a multiple of n. I found this interesting and I am trying to get an efficient way for LARGER NUMBERS I am not able to reach far. How can I do? Ex- 18-> 198 -> sum = 18 and is a multiple of 18 and smallest https://code.sololearn.com/c8AzOi0yh4AH/?ref=app

+3

Brian Lothar Oma Falk SoloProg Vasiliy A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ Ipang Help

+2

Find the smallest number whose sum of digits is N https://www.geeksforgeeks.org/find-the-smallest-number-whose-sum-of-digits-is-n Find the smallest number whose digits multiply to a given number n https://www.geeksforgeeks.org/find-smallest-number-whose-digits-multiply-given-number-n # Keep learning & happy coding :D https://code.sololearn.com/cfzT9WoDUOH5

+2

SoloProg thanks, for your answer, I needed the number not just whose sum of digits is equal to n but also the number should be a multiple of n ... Ex- 18-> 198 (smallest)-> sum = 18 and a multiple of 18 21->399(smallest)-> sum= 21 and a multiple of 21 THE CODE SHOULD HANDLE LARGE NUMBERS

+2

SoloProg It should also be a multiple of 18 ,you are missing the logic

+1

You said "18-> 198 (smallest)-> sum = 18 " I think the answer is 99 as it is the smallest number.

+1