Vb编程题; s=1⼀(1*2)+1⼀(2*3)+1⼀(3*4)+....+1⼀n*(n+1) 要求:N自己确定。。请您书写相应代码?

2025-01-08 09:54:37
推荐回答(1个)
回答1:

Private Sub Command1_Click()
n = InputBox("请输入n:")
For i = 1 To n
t = 1 / (i * (i + 1))
s = s + t
Next i
Print "S=" & s
End Sub