Find the smallest number whose sum of digits is N | Java program to find the smallest number whose sum of digits is also N ; Function to find the smallest number whose sum of digits is also N ; Driver code
class GFG { static void smallestNumber ( int N ) { System . out . print ( ( N % 9 + 1 ) * Math . pow ( 10 , ( N / 9 ) ) - 1 ) ; } public static void main ( String [ ] args ) { int N = 10 ; smallestNumber ( N ) ; } }