n | CPP program to find the n - th term in series ; Function to find nth term ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int sumOfSeries ( int n ) { return n * ( n + 1 ) * ( 6 * n * n * n + 9 * n * n + n - 1 ) / 30 ; } int main ( ) { int n = 4 ; cout << sumOfSeries ( n ) ; return 0 ; }