vb编程:自然对数的底数e的值可由如下无穷级数计算:e=1+1/1!+1/2!+……+1/n!
2个回答
展开全部
Private Sub Form_Click()
Dim N As Integer, e As Single, I As Integer, J As Integer, Jc As Double
N = Int(Val(InputBox("计算的项数N=", "输入", 5)))
Jc = 1
e = 1
For I = 1 To N
Jc = Jc * I
e = e + 1 / Jc
Next
Print "e=1+1/1!+1/2!+……+1/"; N; "! = "; e
End Sub
已经运行过,有什么问题请留言。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1234567891011Private Sub Form_Click() Dim N As Integer, e As Single, I As Integer, J As Integer, Jc As Double N = Int(Val(InputBox("计算的项数N=", "输入", 5))) Jc = 1 e = 1 For I = 1 To N Jc = Jc * I e = e + 1 / Jc Next Print "e=1+1/1!+1/2!+……+1/"; N; "! = "; eEnd Sub
已经运行过,有什么问题请留言。
已经运行过,有什么问题请留言。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询