#include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
double x = 1.0 ;
double y = 2.0 ;
int i = 1 ;
double temp_sum = 0 ;
while(i <= n){
temp_sum += y/x ;
double temp_x1 = y ;
double temp_y1 = x + y ;
x = temp_x1 ;
y = temp_y1 ;
++i;
}
printf("%.2f\n",temp_sum);
return 0;
}
5-0. 求序列前N项和(15)
最新推荐文章于 2022-08-20 11:21:12 发布