title: Triangular Numbers
signature: def triangularNumbers(num: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Boolean , expected: Boolean): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(num: Int, expected: Boolean): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(num),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        97, 
        false    
      )}")   
  
  
      println(s"TEST-1...${driver(
        97, 
        false    
      )}")   
  
  
      println(s"TEST-2...${driver(
        32, 
        false    
      )}")   
  
  
      println(s"TEST-3...${driver(
        40, 
        false    
      )}")   
  
  
      println(s"TEST-4...${driver(
        18, 
        false    
      )}")   
  
  
      println(s"TEST-5...${driver(
        14, 
        false    
      )}")   
  
  
      println(s"TEST-6...${driver(
        90, 
        false    
      )}")   
  
  
      println(s"TEST-7...${driver(
        39, 
        false    
      )}")   
  
  
      println(s"TEST-8...${driver(
        1, 
        true    
      )}")   
  
  
      println(s"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;
  }