vb_slip_2014_3




SLIP 3_1


 



Option Explicit

Private Sub cmdDisplay_Click()
Dim num As Integer
num = Val(Text1.Text)
Dim sum As Integer
Dim reminder As Integer
While num>0
While num > 0
reminder = num Mod 10
sum = sum + reminder
num = num \ 10
Wend
num=sum
wend


MsgBox "Sum of digits in given number is : " & sum

End Sub

Private Sub Text1_Click()
Text1.Text = " "
End Sub

No comments:

Post a Comment

Note: only a member of this blog may post a comment.