text: Find the smallest number whose sum of digits is N | C ++ 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
code: #include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; void smallestNumber ( int N ) { cout << ( N % 9 + 1 ) * pow ( 10 , ( N / 9 ) ) - 1 ; } int main ( ) { int N = 10 ; smallestNumber ( N ) ; return 0 ; }