vb程序设计,把100-200之间的20个数存到一个数组里,求最大值最小值和平均值

2024-12-17 05:37:17
推荐回答(2个)
回答1:

Private Sub Command1_Click()
Dim a(1 To 20)
Dim max, ave, min, sum
max = 0
min = 300
Print "产生的20个数为:";
For i = 1 To 20
a(i) = Int(Rnd() * 100 + 101)
Print a(i);
sum = sum + a(i)
If a(i) > max Then max = a(i)
If a(i) < min Then min = a(i)
Next
Print
Print "平均值为"; sum / 20; "最大值为:"; max; "最小值为:"; min
End Sub

回答2:

EASY