title: Program Print Sum Given Nth Term
signature: pub fn program_print_sum_given_nth_term(n: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        39, 
        1521
      ));
      
      println!("TEST-1...{}", driver(
        20, 
        400
      ));
      
      println!("TEST-2...{}", driver(
        10, 
        100
      ));
      
      println!("TEST-3...{}", driver(
        39, 
        1521
      ));
      
      println!("TEST-4...{}", driver(
        70, 
        4900
      ));
      
      println!("TEST-5...{}", driver(
        21, 
        441
      ));
      
      println!("TEST-6...{}", driver(
        21, 
        441
      ));
      
      println!("TEST-7...{}", driver(
        80, 
        6400
      ));
      
      println!("TEST-8...{}", driver(
        89, 
        7921
      ));
      
      println!("TEST-9...{}", 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;
  }