Write a program in Visual Basic to find out how many horses are standing in the field.
Gather the initial value in a text box.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Declare variables
Dim I, O, B, horses As Integer
'Set values
O = 15
I = txtInitial.Text
B = 7
horses = I - O + B
'Display results
MessageBox.Show("There are " & horses & " horses in the field.")
End Sub
End Class
No comments:
Post a Comment