您的位置首页百科知识 函数double f(int n)返回一下表达式的值: 1+1/2+2/3+3/4+……+(n-1)/n Simone 发布于 2023-09-03 03:23:56 571 阅读 C++版本#includeusing namespace std;double fun(int n){ cin>>n; double sum; sum=2.0-1.0/(n+1); cout<double fun(int n){ scanf("%d",&n); double sum; sum=2.0-1.0/(n+1); printf("%lf",sum); return sum;}int main(){ int x; printf("input"); fun(x); return 0;}