刚学vb不久,遇到个问题难以解决,请高手指点不甚感激!!!
编程:1+(1+2)+(1+2+3)+(1+2+3+4)+…(1+2+3+…N)+… DO While…L oop循环语句编写
很急啊
请高手给个指点啊!!!!!!!!
[ 本帖最后由 因为曾今年少 于 2011-4-18 15:33 编辑 ]
Private Sub Command1_Click() Dim i As Long, j As Long, k As Long, total As Long total = 0: i = 0: j = 0: k = 0 Text1.Text = 0: Text1.Enabled = False j = InputBox("Input Number ?") Do While i < j + 1 For k = i To j total = total + i Next k i = i + 1 Loop Text1.Text = total End Sub