Find Nth term of the series 0 , 2 , 4 , 8 , 12 , 18. . . | CPP program to find N - th term of the series : 0 , 2 , 4 , 8 , 12 , 18. . . ; Calculate Nth term of series ; Driver Function
#include <iostream> NEW_LINE using namespace std ; int nthTerm ( int N ) { return ( N + N * ( N - 1 ) ) / 2 ; } int main ( ) { int N = 5 ; cout << nthTerm ( N ) ; return 0 ; }