title: Triangular Numbers
signature: triangularNumbers(num) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(bool actual, bool expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(num, bool 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(
          97, 
          false)
      }");
  
      print("TEST-1...${driver(
          97, 
          false)
      }");
  
      print("TEST-2...${driver(
          32, 
          false)
      }");
  
      print("TEST-3...${driver(
          40, 
          false)
      }");
  
      print("TEST-4...${driver(
          18, 
          false)
      }");
  
      print("TEST-5...${driver(
          14, 
          false)
      }");
  
      print("TEST-6...${driver(
          90, 
          false)
      }");
  
      print("TEST-7...${driver(
          39, 
          false)
      }");
  
      print("TEST-8...${driver(
          1, 
          true)
      }");
  
      print("TEST-9...${driver(
          57, 
          false)
      }");
  
      return 0;
  }
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;
  }