Wednesday, 18 September 2013

GUI Program to Process arbitrary number of grades

Private Sub cmdenter_Click()
Dim grade,total,count As Integer
Dim average As Single

total=0
grade=0
average=0

grade=InputBox("Enter the grades (-1 to end)")

Do While grade<>-1
count=count+1
total=total+grade
grade=InputBox("Enter the grades(-1 to end)")
Loop

If count<>0 Then
average=total/count
Else
average=0
End If

Text1.Text=Str(average)
End Sub

Private Sub cmdexit_Click()
End
End Sub

No comments:

Post a Comment