Find the Nth term of the series 2 , 15 , 41 , 80 , 132. . . | C ++ program for the above approach ; Recursive function to find Nth term ; Base Case ; Recursive Call according to Nth term of the series ; Driver Code ; Input Nth term ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; int nthTerm ( int N ) { if ( N == 1 ) { return 2 ; } return ( ( N - 1 ) * 13 ) + nthTerm ( N - 1 ) ; } int main ( ) { int N = 17 ; cout << nthTerm ( N ) << endl ; return 0 ; }