C++ program to find sum of series 1+x+x^2+……+x^n

C++ program to find sum of series 1+x+x^2+......+x^n


void main()
clrscr(); //to clear the screen
long i,n,x,sum=1;

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”

  1. 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

Leave a Comment

Your email address will not be published. Required fields are marked *