关于VB编S=1-1/3!+1/5!-1/7…..人脑进入死循环…Private Sub Command1_Click()
Dim n As Integer, i As Integer, s As Integer, p As Integer, j As Integer
n = Val(Text1.Text)
s = 1
p = 1
For i = 2 To (2 * n – 1) Step 1
p = p * (2 * i – 2) * (2 * i – 1)
j = (-1) ^ (i – 1)
s = s + j * (1 / p)
Next i
Text2.Text = Str(s)
End Sub
VB计算S=1-1/3!+1/5!-1/7!+…….+(-1)^(n+1)* 1/(2n-1)!
小弟是学生,在学VB,这代码有什么错误,帮忙看一下。。。。。的问题
这样改下看行吗!~
n = Val(Text1.Text)
s = 1
p = 1
If n