计算机VB中,利用随机函数产生10个10-100的随机数,并将其赋值给数组a,然后求出平均值?

2024-11-21 18:51:51
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim a(10) As Integer
Randomize
For i = 1 To 10
a(i) = Int(Rnd() * 91) + 10
Print a(i);
s = s + a(i)
Next i
Print
Print "平均值="; s / 10
End Sub