title: Check Number Is Perfect Square Using Additionsubtraction
signature: checkNumberIsPerfectSquareUsingAdditionsubtraction(n) {
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(n, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          1, 
          true)
      }");
  
      print("TEST-1...${driver(
          4, 
          true)
      }");
  
      print("TEST-2...${driver(
          9, 
          true)
      }");
  
      print("TEST-3...${driver(
          25, 
          true)
      }");
  
      print("TEST-4...${driver(
          36, 
          true)
      }");
  
      print("TEST-5...${driver(
          3, 
          false)
      }");
  
      print("TEST-6...${driver(
          121, 
          true)
      }");
  
      print("TEST-7...${driver(
          14, 
          false)
      }");
  
      print("TEST-8...${driver(
          17, 
          false)
      }");
  
      print("TEST-9...${driver(
          80, 
          false)
      }");
  
      return 0;
  }
source_py: def check_number_is_perfect_square_using_additionsubtraction(n):
      i = 1
      the_sum = 0
      while (the_sum < n):
          the_sum += i
          if (the_sum == n):
              return True
          i += 2
      return False
source_cpp: bool check_number_is_perfect_square_using_additionsubtraction(int n) {
    for ( int sum = 0, i = 1;
    sum < n;
    i += 2 ) {
      sum += i;
      if ( sum == n ) return true;
    }
    return false;
  }