#include "stdio.h"double fun(int n){ int a=2,b=1,c,k; double s=0.0; for(k=1; k<=n; k++) { s=s+1.0*a/b; c=a; a+=b; b+=c; } return(s) ;}void main(){ int n; printf("请输入整数n:"); scanf("%d",&n); printf("数列前%d项的和为%lf\n",n,fun(n));}