比赛规则:去掉一个最高分和一个最低分,求出剩下得分的平均值
排序啊,找到一组数的最大值和最小值然后把剩下的平均啊
Private Sub Command1_Click()
Dim a(1 To 5) As Integer
For i = 1 To 5
a(i) = InputBox("N")
Next i
Dim max, min, avsum As Single
max = a(1)
min = a(1)
For i = 1 To 5
If max <= a(i) Then
max = a(i)
End If
If min >= a(i) Then
min = a(i)
End If
Next i
For i = 1 To 5
Sum = Sum + a(i)
Next i
avsum = (Sum - max - min) / 3
Print a(1); a(2); a(3); a(4); a(5)
Print max; min; Sum; avsum
End Sub