title: N Th Number Whose Sum Of Digits Is Ten
signature: n_th_number_whose_sum_of_digits_is_ten <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          37L, 
          406L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          13L, 
          136L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          51L, 
          613L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          69L, 
          1054L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          76L, 
          1126L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          10L, 
          109L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          97L, 
          1360L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          40L, 
          433L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          69L, 
          1054L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          4L, 
          46L
      )))
  
  }
  
  main()
source_py: def n_th_number_whose_sum_of_digits_is_ten(n):
      count = 0
      for curr in itertools.count():
          sum = 0
          x = curr
          while x:
              sum = (sum + (x % 10))
              x = (x // 10)
          if (sum == 10):
              count = (count + 1)
          if (count == n):
              return curr
      return (- 1)
source_cpp: int n_th_number_whose_sum_of_digits_is_ten(int n) {
    int count = 0;
    for ( int curr = 1;
    ;
    curr ++ ) {
      int sum = 0;
      for ( int x = curr;
      x > 0;
      x = x / 10 ) sum = sum + x % 10;
      if ( sum == 10 ) count ++;
      if ( count == n ) return curr;
    }
    return - 1;
  }