#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

clrscr(); //to clear the screen

long i,n,x,sum=1;

cout<<“1+x+x^2+……+x^n”;

cout<<“nnEnter the value of x and n:”;

cin>>x>>n;

for(i=1;i<=n;++i)

sum+=pow(x,i);

cout<<“nSum=”<<sum;

getch(); //to stop the screen

}

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