当前位置: > 编译程序按下列公式计算e的值e=1+1/1!+1/2!+3/3!...+1/n!(精度为10的-6次方)...
题目
编译程序按下列公式计算e的值e=1+1/1!+1/2!+3/3!...+1/n!(精度为10的-6次方)

提问时间:2020-10-31

答案
#include
#include
double fun(double x,double eps){
double sum=1.0,m=1.0,t;
int i=1;
do{
m=m*i;
t=pow(x,1)/m;
sum+=t;
i++;
}while (t>eps);
return sum;
}
void main()
{
printf("%f",fun(1,1e-6));
}
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.