title: Program Print Sum Given Nth Term
signature: programPrintSumGivenNthTerm(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int 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(
          39, 
          1521)
      }");
  
      print("TEST-1...${driver(
          20, 
          400)
      }");
  
      print("TEST-2...${driver(
          10, 
          100)
      }");
  
      print("TEST-3...${driver(
          39, 
          1521)
      }");
  
      print("TEST-4...${driver(
          70, 
          4900)
      }");
  
      print("TEST-5...${driver(
          21, 
          441)
      }");
  
      print("TEST-6...${driver(
          21, 
          441)
      }");
  
      print("TEST-7...${driver(
          80, 
          6400)
      }");
  
      print("TEST-8...${driver(
          89, 
          7921)
      }");
  
      print("TEST-9...${driver(
          99, 
          9801)
      }");
  
      return 0;
  }
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;
  }