# C++ Program to find the sum of the series 23+ 45+ 75+….. upto N terms

C++Server Side ProgrammingProgramming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

Best Seller

66 Lectures 5.5 hours

In this tutorial, we will be discussing a program to find the sum of the given series 23+ 45+ 75+….. upto N terms.

For this, we will be given with the value of N and our task is to add up every term starting from the first one to find the sum of the given series.

After solving this, we get the formula for the sum of the series;

Sn = (2n(n+1)(4n+17)+54n)/6

## Example

#include <iostream>
using namespace std;
//calculating the sum of the series
int calc_sum(int N) {
int i;
int sum = (2 * N * (N + 1) * (4 * N + 17) + 54 * N) / 6;
return sum;
}
int main() {
int N = 7;
int res = calc_sum(N);
cout << res << endl;
return 0;
}

## Output

903
Updated on 09-Jul-2020 08:52:15