VB编程计算下列公式的值,其中n (<15)为从键盘输入的正整数。 S=1!+3!+5!+……+(2*n-1)! 急求谢谢!

日期:2013-05-28 15:02:53 人气:1

VB编程计算下列公式的值,其中n (<15)为从键盘输入的正整数。 S=1!+3!+5!+……+(2*n-1)! 急求谢谢!

Private Sub Command1_Click() Dim n As Integer, i As Integer Dim sum As Double n = Val(InputBox("Please Enter N:")) sum = 0 For i = 1 To n sum = sum + fac(2 * i - 1) Next i Print sum End Sub Function fac(n As Integer) As Double Dim f
    A+
热门评论