Header Ads

Learn Together, Stay Connected.

Sum of Power series-C++

 

#include<bits/stdc++.h>


using namespace std;


int main()

{

double x,m;

long long sum=0;

int i;

cin>>x>>m;

for(i=0;i<=m;i++)

  {

  sum+=pow(x,i);

  }


    cout<<sum<<endl;


return 0;

}


No comments

Theme images by Dizzo. Powered by Blogger.