Program code: #include <iostream> #include <math.h> using namespace std; //calculating the sum of the series double calc_sum(int n) { int…