VB编程代码:利用随机函数产生并显示10个两位正整数,计算其平均值(保留三位小数)找出其中大于平均
VB编程代码:利用随机函数产生并显示10个两位正整数,计算其平均值(保留三位小数)找出其中大于平均
日期:2016-05-29 01:22:13 人气:1
Option Base 1
Private Sub Command1_Click()
Randomize
Dim i As Integer, a(10) As Integer, s As Integer, valAverage As Single
For i = 1 To 10
a(i) = Int(Rnd(i) * 90 + 10)
Print a(i);
s = s + a(i)
Next i
Print
valAverage = s / 10