11. Write a VB program to accept a number from user and calculate sum of even digits of a given number.


Private Sub cmdClear_Click()
Text1.Text = “”
Text2.Text = “”
Text1.SetFocus
End Sub

Private Sub cmdSum_Click()
n = Val(Text1.Text)
While n > 0
r = n Mod 10
n = n \ 10
If r Mod 2 = 0 Then
s = s + r
End If
Text2.Text = s
Wend
End Sub

Private Sub cmFxit_Click()
Unload Me
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s