title: Program Print Sum Given Nth Term
signature: programPrintSumGivenNthTerm :: Integer -> Integer
  programPrintSumGivenNthTerm n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Integer -> Integer -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: Integer -> Integer -> String
  driver n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver (39) (1521) )
  
      printf "TEST-1...%s\n" (driver (20) (400) )
  
      printf "TEST-2...%s\n" (driver (10) (100) )
  
      printf "TEST-3...%s\n" (driver (39) (1521) )
  
      printf "TEST-4...%s\n" (driver (70) (4900) )
  
      printf "TEST-5...%s\n" (driver (21) (441) )
  
      printf "TEST-6...%s\n" (driver (21) (441) )
  
      printf "TEST-7...%s\n" (driver (80) (6400) )
  
      printf "TEST-8...%s\n" (driver (89) (7921) )
  
      printf "TEST-9...%s\n" (driver (99) (9801) )
  
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;
  }