Find Nth term of series 1 , 4 , 15 , 72 , 420. . . | CPP program to find N - th term of the series : 1 , 4 , 15 , 72 , 420 a ; Function to find factorial of N ; return factorial of N ; calculate Nth term of series ; Driver Function
#include <iostream> NEW_LINE using namespace std ; int factorial ( int N ) { int fact = 1 ; for ( int i = 1 ; i <= N ; i ++ ) fact = fact * i ; return fact ; } int nthTerm ( int N ) { return ( factorial ( N ) * ( N + 2 ) / 2 ) ; } int main ( ) { int N = 6 ; cout << nthTerm ( N ) ; return 0 ; }