title: Triangular Numbers
signature: pub fn triangular_numbers(num: i32) -> bool {
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: bool, expected: bool)->bool{
  return actual==expected
  }
  pub fn driver(num: i32, expected: bool)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(num), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        97, 
        false
      ));
      
      println!("TEST-1...{}", driver(
        97, 
        false
      ));
      
      println!("TEST-2...{}", driver(
        32, 
        false
      ));
      
      println!("TEST-3...{}", driver(
        40, 
        false
      ));
      
      println!("TEST-4...{}", driver(
        18, 
        false
      ));
      
      println!("TEST-5...{}", driver(
        14, 
        false
      ));
      
      println!("TEST-6...{}", driver(
        90, 
        false
      ));
      
      println!("TEST-7...{}", driver(
        39, 
        false
      ));
      
      println!("TEST-8...{}", driver(
        1, 
        true
      ));
      
      println!("TEST-9...{}", driver(
        57, 
        false
      ));
      
  }
source_py: def triangular_numbers(num):
      if (num < 0):
          return False
      (sum, n) = (0, 1)
      while (sum <= num):
          sum = (sum + n)
          if (sum == num):
              return True
          n += 1
      return False
source_cpp: bool triangular_numbers(int num) {
    if ( num < 0 ) return false;
    int sum = 0;
    for ( int n = 1;
    sum <= num;
    n ++ ) {
      sum = sum + n;
      if ( sum == num ) return true;
    }
    return false;
  }