求助大神,为什么我这个程序最后结果输出是0.000000
#include<stdio.h>#include<conio.h>
fun(int n)
{int a=2,b=1,c,k;
double s=0;
for(k=0;k<=n;k++)
{s=s+(double)a/b;
c=a;
a=a+b;
b=a-b;
}
return s;
}
main()
{int n=5;
printf("\nthe value of function is:%lf\n",fun(n));}