55问答网
所有问题
用C语言程序编写求无理数e的值并输出。公式:e=1+1/1!+1/2!+1/3!+......+1/n! 当1/n!<0.000001时e=2.71828
如题所述
举报该问题
推荐答案 2016-04-15
#include <stdio.h>
int main()
{
int i=1;
float temp=1;
float sum=0;
while(temp>=1e-6)
{
sum+=temp;
temp/=i;
i++;
}
printf("e=1+1/1!+1/2!+1/3!+.=%f",sum);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://55.wendadaohang.com/zd/8GIIGQeFLLQcGRe84c.html
相似回答
大家正在搜
相关问题
用C语言编写程序计算无理数e的值并输出,公式:e=1+1/1...
用c语言编程,求无理数e的近似值,e为下列数列的前n项之和,...
【急】C语言题目,利用公式e=2+1/2!+1/3!+1/4...
证明e 是 无理数(利用e=1+1/1!+1/2!+1/3!...
在科学技术中,常常使用以e为底的对数,常数e是一个无理数,它...
由lim(1+1/n)^2=e可知有理数集合对极限运算不具有...
lim (1 + 1/x)^x =e ,x→∞ (e≈2.7...
已知函数f(x)=e^x-a(x+1)在x=ln2处的切线的...