给定程序MODI1.C中函数fun的功能是:求出以下分数序列的前n项之和。
和值通过函数值返回main函数。例如,n=10,则输出16.479905。
/************found************/
fun(int n)
{ int a,b,c,k;double s;
s=0.0;a=2;b=1;
for (k=1;k<=n;k++)
{/***********found************/
s=s+(Double)a/b;
}
}
main()
{ int n=10;
clrscr();
printf("\n The value of function is:%lf\n",fun(n));
}