vb编程计算1+1/2!+1/3!+1/4!+1/5!的值
展开全部
Private Sub Command1_Click()
n=inputbox("请输入n:")
Dim a As integer
a = 1
Dim sum As Double
For i = 1 To n
For j = 1 To i
a = a * j
Next
sum = sum + 1 / a
a = 1
Next
Print sum
End Sub
n=inputbox("请输入n:")
Dim a As integer
a = 1
Dim sum As Double
For i = 1 To n
For j = 1 To i
a = a * j
Next
sum = sum + 1 / a
a = 1
Next
Print sum
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询