text: Find the smallest number whose sum of digits is N | Function to find the smallest number whose sum of digits is also N ; Driver code
code: function smallestNumber ( N ) { document . write ( ( N % 9 + 1 ) * Math . pow ( 10 , parseInt ( N / 9 , 10 ) ) - 1 ) ; } let N = 10 ; smallestNumber ( N ) ;