所以程序必须把从“x”到“y”的所有数字相加。
但它还必须显示所有添加的数字:
即 10 到 20 应该显示 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 = 165
这是我所拥有的:
Dim firstnum As Integer = Val(TextBox1.Text)
Dim secondnum As Integer = Val(TextBox2.Text)
Dim sum As Integer = 0
While firstnum <= secondnum
sum = sum + firstnum
firstnum = firstnum + 1
Label3.Text = firstnum & "+"
End While
suum.Text = " = " & Val(sum)