vb简单编程:求自然对数e的近似值,当任意项的值小于10^(-4)是结束运算.用公式e=1+1/1!+1/2!+1/nPrivate Sub Command1_Click()Dim a#,s#,e%a = 1s = 1Dos = s * at = 1 / se = e + ta = a + 1Loop While s > 10000Print "e="; eEnd Su
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 06:46:25
vb简单编程:求自然对数e的近似值,当任意项的值小于10^(-4)是结束运算.用公式e=1+1/1!+1/2!+1/nPrivate Sub Command1_Click()Dim a#,s#,e%a = 1s = 1Dos = s * at = 1 / se = e + ta = a + 1Loop While s > 10000Print "e="; eEnd Su
vb简单编程:求自然对数e的近似值,当任意项的值小于10^(-4)是结束运算.用公式e=1+1/1!+1/2!+1/n
Private Sub Command1_Click()
Dim a#,s#,e%
a = 1
s = 1
Do
s = s * a
t = 1 / s
e = e + t
a = a + 1
Loop While s > 10000
Print "e="; e
End Sub
错在哪?求分析错误程序
vb简单编程:求自然对数e的近似值,当任意项的值小于10^(-4)是结束运算.用公式e=1+1/1!+1/2!+1/nPrivate Sub Command1_Click()Dim a#,s#,e%a = 1s = 1Dos = s * at = 1 / se = e + ta = a + 1Loop While s > 10000Print "e="; eEnd Su
Dim a As Double
Dim s As Double
Dim e As Single
Dim t As Single
a = 1
s = 1
e = 1
Do While 1 / s >= 10 ^ (-0.4)
s = s * a
t = 1 / s
e = e + t
a = a + 1
Loop
Print "e="; e