十万火急 浙大OJ 1113 u Calculate e 显示Output Limit Exceeded 大侠帮我看看 这是怎么了?BackgroundA simple mathematical formula for e is where n is allowed to go to infinity.This can actually yield very accurate approximations of e us
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 12:23:39
十万火急 浙大OJ 1113 u Calculate e 显示Output Limit Exceeded 大侠帮我看看 这是怎么了?BackgroundA simple mathematical formula for e is where n is allowed to go to infinity.This can actually yield very accurate approximations of e us
十万火急 浙大OJ 1113 u Calculate e 显示Output Limit Exceeded 大侠帮我看看 这是怎么了?
Background
A simple mathematical formula for e is
where n is allowed to go to infinity.This can actually yield very accurate approximations of e using relatively small values of n.
Output
Output the approximations of e generated by the above formula for the values of n from 0 to 9.The beginning of your output should appear similar to that shown below.
Example
Output
n e
- -----------
0 1
1 2
2 2.5
3 2.666666667
4 2.708333333
这是我的代码.
#include
int main()
{
int n,b;
double e,a=1.00;
for(n=0;n=2)
{
a=a/n;
e=e+a;
}
printf("%lf\n",e);
}
return 0;
}
十万火急 浙大OJ 1113 u Calculate e 显示Output Limit Exceeded 大侠帮我看看 这是怎么了?BackgroundA simple mathematical formula for e is where n is allowed to go to infinity.This can actually yield very accurate approximations of e us
#include
#include
using namespace std;
int F(int n)
{
int i,m=1;
for(i=1;i