Find the Nth term of the series 2 + 6 + 13 + 23 + . . . | CPP program to find Nth term of the series 2 + 6 + 13 + 23 + 36 + ... ; calculate Nth term of given series ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int Nth_Term ( int n ) { return ( 3 * pow ( n , 2 ) - n + 2 ) / ( 2 ) ; } int main ( ) { int N = 5 ; cout << Nth_Term ( N ) << endl ; }