vb程序里计算1/1!+1/2!+1/3!+1/4!+.+1/n!

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 20:37:14
vb程序里计算1/1!+1/2!+1/3!+1/4!+.+1/n!
x)+Kz=/-|n0&z@*O&H$v6PYX\b VXWZS[&"xp 8`y &`,[C0-SWȃ e@BH:@BX/9VDj )°ط8)uK~qAb(,w

vb程序里计算1/1!+1/2!+1/3!+1/4!+.+1/n!
vb程序里计算1/1!+1/2!+1/3!+1/4!+.+1/n!

vb程序里计算1/1!+1/2!+1/3!+1/4!+.+1/n!
Private Sub Command1_Click()
Dim n As Integer,tmp As Double,sum As Double
Dim i As Integer,j As Integer
n = 4
tmp = 1
For i = 1 To n
For j = 2 To i
tmp = tmp * j
Next
sum = sum + 1 / tmp
tmp = 1
Next
MsgBox sum
End Sub