Visual Basic (2008 Express)
Count

A sequence of 10 marks is to be input. The program counts how many of these marks are over 50, and outputs the answer to a TextBox called txtAnswer.

 

Dim Mark As Integer
Dim
counter As Integer
Dim
i As Integer

'Initialise counter
counter = 0

For i = 1 To 10

    'Input mark
    Mark = InputBox("Please enter mark")

    If Mark > 50 Then

        'Add 1 to counter
        counter = counter + 1

    End If

Next

txtAnswer.Text = counter

 

 
 

   Back