我想補充一個給定的數字的總和,即1234總和添加一個數字的總和10 這是我的代碼用vb.net
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim number As Integer
Dim r As Integer
Dim sum As Integer
number = Val(TextBox1.Text)
While (number <> 0)
r = number Mod 10
sum = sum + r
number = number/10
End While
Label3.Text = sum
End Sub
,但是當我輸入123456它給了我24而不是21,我的代碼有什麼問題?
使用數=數字\ 10個 –