VB语言题目:计算y=2/3!+5/6!+8/9!
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/30 05:07:15
VB语言题目:计算y=2/3!+5/6!+8/9!VB语言题目:计算y=2/3!+5/6!+8/9!VB语言题目:计算y=2/3!+5/6!+8/9!PrivateSubCommand1_Click(
VB语言题目:计算y=2/3!+5/6!+8/9!
VB语言题目:计算y=2/3!+5/6!+8/9!
VB语言题目:计算y=2/3!+5/6!+8/9!
Private Sub Command1_Click()
Dim I As Integer, N As Double
N = 0
For I = 2 To 8 Step 3
N = N + I / (Factorial(I + 1))
Next
Print N
End Sub
Function Factorial(X As Double) As Double
If X = 1 Then
Factorial = 1
Else
Factorial = X * Factorial(X - 1)
End If
End Function