Question: write a function solution that , given integer N, returns the smallest non negative integer whose individual digits sum to N. Given N = 16,

write a function solution that , given integer N, returns the smallest non negative integer whose individual digits sum to N.

Given N = 16, the function should return 79, there are many numbers whose digits sum to 16 (for example : 79, 97,808,551,22822,etc.) . the smallest such number is 79.

2. given N = 19, THE FUNCTION SHOULD RETURN 199 (the sum of digits is 1+9+9 = 19).

3. Given N= 7, the function should return 7.

asume that:

N is an interger within the range [0..50].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!