title: Check Number Is Perfect Square Using Additionsubtraction
signature: function check_number_is_perfect_square_using_additionsubtraction(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(1, true);
      @printf("TEST-0...%s\n",result);
      
      result = driver(4, true);
      @printf("TEST-1...%s\n",result);
      
      result = driver(9, true);
      @printf("TEST-2...%s\n",result);
      
      result = driver(25, true);
      @printf("TEST-3...%s\n",result);
      
      result = driver(36, true);
      @printf("TEST-4...%s\n",result);
      
      result = driver(3, false);
      @printf("TEST-5...%s\n",result);
      
      result = driver(121, true);
      @printf("TEST-6...%s\n",result);
      
      result = driver(14, false);
      @printf("TEST-7...%s\n",result);
      
      result = driver(17, false);
      @printf("TEST-8...%s\n",result);
      
      result = driver(80, false);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
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;
  }