title: N Th Number Whose Sum Of Digits Is Ten 1
signature: func nThNumberWhoseSumOfDigitsIsTen1(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(93, 1324)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(10, 109)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(55, 703)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(94, 1333)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(2, 28)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(5, 55)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(37, 406)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(4, 46)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(11, 118)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(46, 523)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def n_th_number_whose_sum_of_digits_is_ten_1(n):
      count = 0
      curr = 19
      while True:
          sum = 0
          x = curr
          while (x > 0):
              sum = (sum + (x % 10))
              x = int((x / 10))
          if (sum == 10):
              count += 1
          if (count == n):
              return curr
          curr += 9
      return (- 1)
source_cpp: int n_th_number_whose_sum_of_digits_is_ten_1(int n) {
    int count = 0;
    for ( int curr = 19;
    ;
    curr += 9 ) {
      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;
  }