会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 02:40:04
会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!Priv

会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!
会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!

会VB语言的进!计算1/1!+1/3!+1/5!+.+1/99!
Private Sub Command1_Click()
Dim i As Integer
Dim nn As Double
For i = 1 To 99 Step 2
nn = nn + 1 / jiecheng(i)
Next i
Print nn
End Sub
Function jiecheng(n As Integer)
Dim i As Integer
Dim nn As Double
nn = 1
For i = 1 To n
nn = nn * i
Next i
jiecheng = nn
End Function