<span style="font-size:18px;">float a[20] = {};
float b = 2, c = 1,temp = 0;
float sum = 0;
for (int i = 0; i < 20; i++) {
a[i] = b / c;
temp = b;
b = b + c;
c = temp;
sum += a[i];
}
printf("%.2f",sum);</span>
有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。
最新推荐文章于 2023-03-19 20:30:32 发布