text: Program to find Nth term of the series 3 , 6 , 18 , 24 , ... | CPP program to find N - th term of the series : 3 , 6 , 18 , 24 , 45 , 54. . . ; function to calculate Nth term of series ; By using above formula ; Driver Function ; get the value of N ; Calculate and print the Nth term
code: #include <iostream> NEW_LINE using namespace std ; int nthTerm ( int N ) { return ( N * ( ( N / 2 ) + ( ( N % 2 ) * 2 ) + N ) ) ; } int main ( ) { int N = 5 ; cout << " Nth ▁ term ▁ for ▁ N ▁ = ▁ " << N << " ▁ : ▁ " << nthTerm ( N ) ; return 0 ; }