Private Sub Command1_Click()
Randomize
Dim a(10) As Integer, imas as integer, imin as integer, Average as integer
imax = 49
imin = 101
Average=0
For i = 0 To 9
a(i) = Int(Rnd * 51) + 50
Average=Average+a(i)
If imax < a(i) Then imax = a(i)
If imin > a(i) Then imin = a(i)
Print a(i),
Next
Print
Print "最大值和最小值和平均值是:"; imax; imin; Average / 10
End Sub
楼上的平均值计算是错误的,并且循环多了一次
温馨提示:内容为网友见解,仅供参考