title: Sum Of All Proper Divisors Of A Natural Number
signature: pub fn sum_of_all_proper_divisors_of_a_natural_number(num: i32) -> f32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: f32, expected: f32)->bool{
  return (actual - expected).abs() < 1e-06
  }
  pub fn driver(num: i32, expected: f32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(num), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        2, 
        1.0
      ));
      
      println!("TEST-1...{}", driver(
        57, 
        23.0
      ));
      
      println!("TEST-2...{}", driver(
        28, 
        28.0
      ));
      
      println!("TEST-3...{}", driver(
        43, 
        1.0
      ));
      
      println!("TEST-4...{}", driver(
        38, 
        22.0
      ));
      
      println!("TEST-5...{}", driver(
        29, 
        1.0
      ));
      
      println!("TEST-6...{}", driver(
        45, 
        33.0
      ));
      
      println!("TEST-7...{}", driver(
        47, 
        1.0
      ));
      
      println!("TEST-8...{}", driver(
        44, 
        40.0
      ));
      
      println!("TEST-9...{}", driver(
        3, 
        1.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 );
  }