Program to find Nth term of the series 3 , 12 , 29 , 54 , 87 , ... | CPP program to find N - th term of the series : 3 , 12 , 29 , 54 , 87 , ... ; calculate Nth term of series ; Return Nth term ; driver code ; declaration of number of terms ; Get the Nth term
#include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; int getNthTerm ( long long int N ) { return 4 * pow ( N , 2 ) - 3 * N + 2 ; } int main ( ) { long long int N = 10 ; cout << getNthTerm ( N ) ; return 0 ; }