Program to print the Sum of series | CPP program to find SUM upto N - th term of the series : - 1 , 2 , 11 , 26 , 47 , 74 , ... . . ; calculate Nth term of series ; Driver Function ; Get the value of N ; Get the sum of the series
#include <iostream> NEW_LINE using namespace std ; int findSum ( int N ) { return ( N * ( N + 1 ) * ( 2 * N - 5 ) + 4 * N ) / 2 ; } int main ( ) { int N = 3 ; cout << findSum ( N ) << endl ; return 0 ; }