Find the sum of series 3 , 7 , 13 , 21 , 31. ... | C ++ Program to find the sum of given series ; Function to calculate sum ; Return sum ; Driver code
#include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; int findSum ( int n ) { return ( n * ( pow ( n , 2 ) + 3 * n + 5 ) ) / 3 ; } int main ( ) { int n = 25 ; cout << findSum ( n ) ; return 0 ; }