# C++ program to find the sum of the series x+x^2/2+x^3/3+…..+x^n/n

#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr(); //to clear the screen
int i,n;
float x,sum=0;

cout<<“x+x^2/2+x^3/3+…..+x^n/n”;
cout<<“nEnter value of x and n:”;
cin>>x>>n;

for(i=1;i<=n;++i)
sum+=pow(x,i)/i;

cout<<“nsum=”<<sum;
getch(); //to stop the screen
}

### 5 thoughts on “C++ program to find the sum of the series x+x^2/2+x^3/3+…..+x^n/n”

1. This helped. I’m using Python but it wasn’t hard to base mine on this. 🙂

2. Can anyone solve this.
input from user any alphabet and decimal number, generate its binary form, using multiple statement if else, then if user press 1 it means he want to see its graphical representation in non return to zero NRZ form, if he press 2 show its graphical representation in retun zero RZ form.

3. Prgrm to print series s=x+x^2+x^3….in c++

1. void main()
{
long int i,n,x,sum=0;
cout<>x>>n;
for(i=1;I<=n;I++)
sum+=pow(x,i);
cout <<"sum="<<sum;
getch();
}

4. Can you give the program for making an equilateral triangle
i.e. 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5