clrscr(); //to clear the screen
cout<<“nnEnter the value of x and n:”;
getch(); //to stop the screen
3 thoughts on “C++ program to find sum of series 1+x+x^2+……+x^n”
above program is correct, but you are considered as first term is 1 manually. it cannot calculated from formula.
Instead of that some changes in your program
for loop is initialize with zero (0) instead of one(1)
because power of any number is always 1 and this is our first term of series
U used a function….instead of using loop…so can u plz …write the same programme using a function….
Above output is wrong…
Please correct the mistake.