Sample Visual Basic 6 Program for Odd numbers

Sample Visual Basic 6 Program for Odd numbers


Dim a As String
Dim b As String
Dim count_ As String
Dim total As String
Private Sub Command1_Click()
a = InputBox("First number:")
b = InputBox("Second number:")
total = 0
count_ = 0
Do While a <= b
    If (a Mod 2) <> 0 Then
        count_ = count_ + 1
        total = total + Val(a)
    End If
    a = a + 1
Loop
total = total / count_
MsgBox (total)
End Sub

Sample Visual Basic 6 Program for Odd numbers

Share this

Related Posts

There was an error in this gadget