下面函数的功能是计算s=1+1/(1*2)+1/(1*2*3)+...+1/(1*2*3*...*n),请填空。 double+fun(int+n) { +____+s=0.0,fac=1.0
时间: 2024-04-05 14:26:04 浏览: 69
求!+!+!++n!-过程和函数
```c
double fun(int n)
{
double s = 0.0, fac = 1.0;
for (int i = 1; i <= n; i++)
{
fac *= i;
s += 1 / fac;
}
return s;
}
```
阅读全文