sum of digits of smallest number equals to n

135


Example

i/p: 11

o/p: 29

Following is sample java code.

#include <stdio.h>
int main()
{
  long n;
  scanf("%ld",&n);
  long nines=n/9;
  if(n%9!=0){
    printf("%ld",n%9);
  }
  while(nines--){
    printf("9");
  }
}