Signup/Sign In

C++ Program To Find Sum Of Series x + x ^ 2 / 2 + x ^ 3 / 3 + x ^ 4 / 4 + . . . . . . . . . x ^ n / n

Here, in this tutorial, we will be seeing how to write the program for the given pattern and at the end print the resultant sum of the series formed for the input number of terms by the user.

C++ Program To Print The Sum of The Pattern

Before moving towards the program let's first see the approach for solving this problem.

This is a very simple series just take an input a value of 'X' and numbers of terms and calculate the sum .at the end print the sum the logic is given below.




Also here we will take the value of sum as a float datatype so that our answer could be more accurate and correct.

using namespace std;
int main()
 int i,n;
 float x,sum=0;

 cout<<"\nEnter value of x and n :\n";

 cout<<"\nSum is = "<<sum<<endl;
 return 0;


Enter value of x and n :
2 3

Sum is = 6.66667


That sums up this article detailing one program, each in C++, to find the sum of the series x + x2/2 +x3/3 + ……. +xn/n. There can be different programs for calculating for other variations of the series.

About the author:
Nikita Pandey is a talented author and expert in programming languages such as C, C++, and Java. Her writing is informative, engaging, and offers practical insights and tips for programmers at all levels.