#include<iostream>
using namespace std;
int main()
{
float x,sum,no_row;
int i,n;
cout<<"input the number:";
cin>>x;
cout<<"enter the number of term:";
cin>>n;
sum =1; no_row = 1;
for (i=1;i<n;i++)
{
no_row = no_row*x/(float)i;
sum =sum+ no_row;
}
cout<<"the sum is:"<<sum;
cout<<endl;
}
No comments:
Post a Comment