// C++ implementation to find the sum
// of the given series
#include <bits/stdc++.h>
using namespace std;
// function to find the sum
// of the given series
int sumOfTheSeries(int n)
int sum = 0;
for (int i = 1; i <= n; i++)
// first term of each i-th term
int k = 2;
for (int j = 1; j <= i; j++)
sum += k;
// next term
k += 2;
// required sum
return sum;
// Driver program to test above
int main()
int n = 5;
cout << "Sum = "
<< sumOfTheSeries(n);
return 0;