title: Sum Of All Proper Divisors Of A Natural Number
signature: sumOfAllProperDivisorsOfANaturalNumber(num) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(double actual, double expected){
      return (actual - expected).abs() < 1e-06;
  }
  
  String driver(num, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(num), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          2, 
          1.0)
      }");
  
      print("TEST-1...${driver(
          57, 
          23.0)
      }");
  
      print("TEST-2...${driver(
          28, 
          28.0)
      }");
  
      print("TEST-3...${driver(
          43, 
          1.0)
      }");
  
      print("TEST-4...${driver(
          38, 
          22.0)
      }");
  
      print("TEST-5...${driver(
          29, 
          1.0)
      }");
  
      print("TEST-6...${driver(
          45, 
          33.0)
      }");
  
      print("TEST-7...${driver(
          47, 
          1.0)
      }");
  
      print("TEST-8...${driver(
          44, 
          40.0)
      }");
  
      print("TEST-9...${driver(
          3, 
          1.0)
      }");
  
      return 0;
  }
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 );
  }