Vb求N的阶层我自己做的,Private Sub Form_Click()Dim a As Single,b As Integer,c As Integer,d As Singlea = 1b = 1c = 0d = 0Do While Abs(b / a) > 0.000001d = d + b / ac = c + 1a = a * cb = -bLoopPrint dEnd Sub
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 16:37:05
Vb求N的阶层我自己做的,Private Sub Form_Click()Dim a As Single,b As Integer,c As Integer,d As Singlea = 1b = 1c = 0d = 0Do While Abs(b / a) > 0.000001d = d + b / ac = c + 1a = a * cb = -bLoopPrint dEnd Sub
Vb求N的阶层
我自己做的,
Private Sub Form_Click()
Dim a As Single,b As Integer,c As Integer,d As Single
a = 1
b = 1
c = 0
d = 0
Do While Abs(b / a) > 0.000001
d = d + b / a
c = c + 1
a = a * c
b = -b
Loop
Print d
End Sub
Vb求N的阶层我自己做的,Private Sub Form_Click()Dim a As Single,b As Integer,c As Integer,d As Singlea = 1b = 1c = 0d = 0Do While Abs(b / a) > 0.000001d = d + b / ac = c + 1a = a * cb = -bLoopPrint dEnd Sub
Do While Abs(b / a) > 0.000001 这条语句应该就不是对的.
而且.你这个题出的也不全.没有给出n.如果这样.你应该自己生成一个.
然后.就不是Do While Abs(b / a) > 0.000001
应该是do while c