:
运行过了谈斗
输出e=2.718282
不含敬磨知是否满意
望采纳
#include
void
main(){
long
fun(int
n)
int
i
double
e=0
double
eps=1e-6//eps表示精度
此处指10的-6次方
for(i=01.0/稿蠢fun(i)>epsi++)
{
e+=1.0/fun(i)
}
printf("e=%lf\n",e)
}
long
fun(int
n)//求n!的函数
{
if(n==0)
return
1
else
return
n*fun(n-1)
}
以下程序笑渗庆没有经过调试(我在网吧,没带编译器),但多少可提供思路#include "math.h"
void main()
{
double e
unsigned int n=65535/碰握/用65535表示数喊哗学意义上的‘无穷大’
e=1+1/n
e=pow(e,n)//pow(double x,double n)表示求X的N次方
printf("%f",pow(e,2.567))
getch()
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)