Program to find the Nth term of the series 0 , 14 , 40 , 78 , 124 , ... | CPP program to find the N - th term of the series 0 , 14 , 40 , 78 , 124 . . . ; calculate sum upto Nth term of series ; return the final sum ; Driver code
#include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; int nthTerm ( int n ) { return 6 * pow ( n , 2 ) - 4 * n - 2 ; } int main ( ) { int N = 4 ; cout << nthTerm ( N ) ; return 0 ; }