Find the sum of first N terms of the series 2 * 3 * 5 , 3 * 5 * 7 , 4 * 7 * 9 , ... | C ++ program to find sum of the first n terms of the given series ; Function to return the sum of the first n terms of the given series ; As described in the approach ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int calSum ( int n ) { return ( n * ( 2 * n * n * n + 12 * n * n + 25 * n + 21 ) ) / 2 ; } int main ( ) { int n = 3 ; cout << calSum ( n ) ; return 0 ; }