VB程序编写求满足条件1+2+3+…+N>1000的最小N

2024-11-25 19:41:20
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim n As Integer, s As Integer
n = 1
s = 0
While s < 1000
s = s + n
n = n + 1
Wend
MsgBox "最小n是:" & n - 1
End Sub