title: Program Print Sum Given Nth Term
signature: function program_print_sum_given_nth_term(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(39, 1521);
      @printf("TEST-0...%s\n",result);
      
      result = driver(20, 400);
      @printf("TEST-1...%s\n",result);
      
      result = driver(10, 100);
      @printf("TEST-2...%s\n",result);
      
      result = driver(39, 1521);
      @printf("TEST-3...%s\n",result);
      
      result = driver(70, 4900);
      @printf("TEST-4...%s\n",result);
      
      result = driver(21, 441);
      @printf("TEST-5...%s\n",result);
      
      result = driver(21, 441);
      @printf("TEST-6...%s\n",result);
      
      result = driver(80, 6400);
      @printf("TEST-7...%s\n",result);
      
      result = driver(89, 7921);
      @printf("TEST-8...%s\n",result);
      
      result = driver(99, 9801);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def program_print_sum_given_nth_term(n):
      S = 0
      for i in range(1, (n + 1)):
          S += ((i * i) - ((i - 1) * (i - 1)))
      return S
source_cpp: int program_print_sum_given_nth_term(long n) {
    int S = 0;
    for ( int i = 1;
    i <= n;
    i ++ ) S += i * i - ( i - 1 ) * ( i - 1 );
    return S;
  }