下列给定的程序中,函数fun()的功能是:求出以下分数序列的前n项和。
2/1,3/2,5/3,8/5,13/8,21/13,…
其值通过函数值返回main()函数。例如,若输入n=5,则应输出8.391667。
[注意] 部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
[试题源程序]
#include<stdio.h>
#include<conio.h>
double fun(int n)
int a=2, b=1, c, k;
double[
(1) ];
for(k=1; k<=n; k++)
s=s+1.0 *a/b;
c=a; a+=[
(2) ]; b=c;
return(d);
main()
int n=5;
printf("\nThe value of function is: %1f\n", [
(3) ]);