通过次数
0
提交次数
按下面要求编写程序:
(1)定义函数f(n)计算n+(n+1)+…+(2n-1),函数返回值类型是double。
(2)定义函数main(),输入正整数n,计算并输出下列算式的值。要求调用函数f(n)计算n+(n+1)+…+(2n-1)。
<img src="http://tk.hustoj.com:80/upload/pimg1337_1.png" alt="" height="46" width="399" />
10
s=1.417566