VB计算 1-1/3!+1/5!-1/7!+……+(-1)^(n-1)/(2n-1)!请填空Private Sub Command1_Click()Dim i As Integer,j As IntegerDim n As IntegerDim s As Doublej=1s=1n = Val(Text1.Text)For i = 2 To nj=__________ '计算1/(2*i-1)!s=_______________' l累加通项式Next itext2.text=str(s)
问题描述:
VB计算 1-1/3!+1/5!-1/7!+……+(-1)^(n-1)/(2n-1)!请填空
Private Sub Command1_Click()
Dim i As Integer,j As Integer
Dim n As Integer
Dim s As Double
j=1
s=1
n = Val(Text1.Text)
For i = 2 To n
j=__________ '计算1/(2*i-1)!
s=_______________' l累加通项式
Next i
text2.text=str(s)
答
j * (2 * i - 2) * (2 * i - 1)
s + (-1) ^ (n - 1) / j