Dim a(1 To 20) As Integer
Private Sub Command1_Click()
Cls
Scale (0, 0)-(100, 100)
For u = 1 To 20
a(u) = Int(Rnd * 50) + 50
b = b + a(u)
Print a(u)
Next u
c = b / 20
For i = 1 To 19
For j = i + 1 To 20
If a(i) > a(j) Then temp = a(i): a(i) = a(j): a(j) = temp
Next j
Next i
CurrentX = 10: CurrentY = 20
Print "最大值为" & a(20) & " " & "最小值为" & a(1) & " " & "平均值为" & c
End Sub
我试过的 没问题 你看看,有疑问再联系我!!
Private Sub Command1_Click()
Dim 数%, 最大值%, 最小值%, 平均值%, 和%
最小值 = 9999
For i = 1 To 20
数 = Rnd * 50 + 0.5 + 50
Print 数;
If 数 > 最大值 Then 最大值 = 数
If 数 < 最小值 Then 最小值 = 数
和 = 和 + 数
Next i
平均值 = 和 / 20
Print
Print "最小值:" & 最小值
Print "最大值:" & 最大值
Print "平均值:" & 平均值
End Sub