编写c语言程序,输入n并计算下列多项式的值:s=1/1*2+1/2*3+……+1/n*(n+1)
时间: 2023-10-29 22:07:17 浏览: 151
```c
#include <stdio.h>
int main() {
int n, i;
double s = 1.0;
scanf("%d", &n);
for (i = 2; i <= n; i++) {
s += 1.0 / (i * (i - 1));
}
printf("The value of the polynomial is %.6lf\n", s);
return 0;
}
```
阅读全文