title: Sum Of All Proper Divisors Of A Natural Number
signature: fun sumOfAllProperDivisorsOfANaturalNumber(num: Int): Float {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Float, expected:Float):Boolean{
    return abs(actual - expected) < 1e-06f
  }
  fun driver(num: Int, expected:Float):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(num), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(2, 1.0f)
      println("TEST-0...${result}")
      
      result = driver(57, 23.0f)
      println("TEST-1...${result}")
      
      result = driver(28, 28.0f)
      println("TEST-2...${result}")
      
      result = driver(43, 1.0f)
      println("TEST-3...${result}")
      
      result = driver(38, 22.0f)
      println("TEST-4...${result}")
      
      result = driver(29, 1.0f)
      println("TEST-5...${result}")
      
      result = driver(45, 33.0f)
      println("TEST-6...${result}")
      
      result = driver(47, 1.0f)
      println("TEST-7...${result}")
      
      result = driver(44, 40.0f)
      println("TEST-8...${result}")
      
      result = driver(3, 1.0f)
      println("TEST-9...${result}")
      
          
  }
  
  main()
source_py: def sum_of_all_proper_divisors_of_a_natural_number(num):
      result = 0
      i = 2
      while (i <= math.sqrt(num)):
          if ((num % i) == 0):
              if (i == (num / i)):
                  result = (result + i)
              else:
                  result = (result + (i + (num / i)))
          i = (i + 1)
      return (result + 1)
source_cpp: int sum_of_all_proper_divisors_of_a_natural_number(int num) {
    int result = 0;
    for ( int i = 2;
    i <= sqrt ( num );
    i ++ ) {
      if ( num % i == 0 ) {
        if ( i == ( num / i ) ) result += i;
        else result += ( i + num / i );
      }
    }
    return ( result + 1 );
  }