Private Sub Form_Click()
Randomize
Dim a(0 To 19) As Integer
Dim average As Single
Dim s As Single
For i = 0 To 19
a(i) = Int(Rnd() * 100)
Print (a(i) & " ");
average = average + a(i)
Next i
Print
average = average / 20
For i = 0 To 19
s = s + (a(i) - average) ^ 2
Next i
s = s / 20
Print ("方差为" & s)
Print ("标准差为" & Sqr(s))
Print
End Sub
希望能帮到你