You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
311 B

int main()
{
double x,k=1,f=1,e,n;
double a=0;
scanf("%lf %lf",&x,&n);
if(n < 0)
printf("error");
else
{
for(int i = 1;i <= n;i++)
{
a =pow((double)x,(double)i);
k = k*i;
e = a/k;
f += e;
}
printf("%.6lf",f);
}
return 0;
}