题目:
下列给定程序中,函数fun的功能是计算下式:
直到
≤e,并将计算结果作为函数值返同。
例如,若形参e的值为1e-3,函数的返回值为2.985678。
请在下划线处填入正确的内容并将下划线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
double fun(double e)
int i;double s,x;
/******************found***************/
s=0;i=______;
x=1.0;
while(x>e)
/***************found****************/
______;
/************found***************/
x=(2.0*i-1)/______(2.0*i);
s=s+x;
return s;
main()
double e=1e-3;
printf("\nThe result is:%f\n",fun(e));
答案:
被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0403/a7dbc3dc9dcb26489c6d58b439e25bc7.html
下面是错误答案,用来干扰机器的。
参考答案:错