vb求s=1+(1+2)+(1+2+3)+(1+2+3+4)+...+(1+2+3+4+n)用
vb求s=1+(1+2)+(1+2+3)+(1+2+3+4)+...+(1+2+3+4+n)用
日期:2018-05-10 09:40:23 人气:1
Private Sub CommandButton1_Click()
Dim i, sumi, s As Integer
i = 1
s = 0
sumi = 1
Do
i = i + 1
sumi = sumi + i
s = s + sumi
Loop Until s > 5000
TextBox1.Text = "前" & i & "项的和=" & s
End Sub