title: Triangular Numbers
signature: triangularNumbers :: Integer -> Bool
  triangularNumbers num = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Bool -> Bool -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: Integer -> Bool -> String
  driver num expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME num) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (97) (False) )
  
      printf "TEST-1...%s\n" (driver (97) (False) )
  
      printf "TEST-2...%s\n" (driver (32) (False) )
  
      printf "TEST-3...%s\n" (driver (40) (False) )
  
      printf "TEST-4...%s\n" (driver (18) (False) )
  
      printf "TEST-5...%s\n" (driver (14) (False) )
  
      printf "TEST-6...%s\n" (driver (90) (False) )
  
      printf "TEST-7...%s\n" (driver (39) (False) )
  
      printf "TEST-8...%s\n" (driver (1) (True) )
  
      printf "TEST-9...%s\n" (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;
  }