早教吧作业答案频道 -->其他-->
十万火急浙大OJ1113uCalculatee显示OutputLimitExceeded大侠帮我看看这是怎么了?BackgroundAsimplemathematicalformulaforeiswherenisallowedtogotoinfinity.Thiscanactuallyyieldveryaccurateapproximationsofeus
题目详情
十万火急 浙大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;
}
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;
}
▼优质解答
答案和解析
#include
#include
using namespace std;
int F(int n)
{
int i,m=1;
for(i=1;i
#include
using namespace std;
int F(int n)
{
int i,m=1;
for(i=1;i
看了 十万火急浙大OJ1113uC...的网友还看了以下:
已知集合A、B满足A∪B=U(U为全集),则下列关系一定正确的是A B⊆ A补 B A∩B= 空集 2020-05-15 …
椭圆(x^2/9)+(y^2/m)=1(9>m>0)和双曲线(x^2/9)-(y^2/n)=1的离 2020-06-03 …
如果O+O=U+U+U,O+Z=U+U+U+U,那么Z+Z+U=()个O.如果设U=6,那么O=( 2020-06-18 …
定义点P(x0,y0)到直线l:Ax+By+C=0(A2+B2≠0)的有向距离为d=Ax0+By0 2020-07-09 …
请高手用MATLAB帮忙解下微分方程组教下:Dy(1)=y(2);Dy(2)=y(3)^2*u*A 2020-07-21 …
已知l,m,n是三条不同的直线,α,β是不同的平面,则α⊥β的一个充分条件是()A.lα,mβ,且 2020-07-26 …
函数w=1/z,把z平面上x^2+(y-1)^2=4映射成w平面上怎样的曲线?z=1/w=1/(u 2020-07-30 …
设f(x)在x=0的某个领域U(0,m)内有定义设f(x)在x=0的某个邻域U(0,m)内有定义, 2020-07-31 …
+MW=U+U+M=WTW啥意思 2020-11-01 …
纯电感交变电路中[U=U反设有纯电感交变电路,由于无电阻,电能全部转化为磁场能.这样一来就得到U=U 2020-11-27 …