已知S=1+2+3+.......+N,找出一个最大的整数N,使得S<30000。编写程序解决这个问题。
要求用doloop until
Private Sub Command1_Click()
n = 0
s = 0
Do
n = n + 1
s = s + n
Loop Until s > 30000
Print "s="; s, "n="; n
Private Sub Command1_Click()
Dim n, sum
n = 0
sum = 0
While sum < 30000 n = n + 1 sum = sum + n
Wend
sum = sum - n
n = n - 1
Debug.Print sum
Debug.Print n
End Sub