Write a program that asks the user to input two numbers in two variables x and n. Now find and properly display the sum of following series. X+X²+X³…………………Xᴺ

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int x,n,sum;
sum=0;
cout<<“ENter the x: “;
cin>>x;
cout<<“Enter the n: “;
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<pow(x,i)<<“\t”;
sum=sum+pow(x,i);
}
cout<<“\n sum of all is”<<sum;

}