编程,vb,这道题怎么写?第一题。
2个回答
展开全部
Private Sub Command1_Click()
Dim a(10) As Integer
Dim sum As Integer
Dim avg As Double
Dim n As Integer
n = 0
sum = 0
For i = 1 To 10
Randomize
a(i) = Int(Rnd * 90) + 10
sum = sum + a(i)
Next i
avg = sum / 10
For i = 1 To 10
If a(i) > avg Then
n = n + 1
End If
Next i
MsgBox ("平均数是" & avg & ",比平均数大的数字有" & n & "个")
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询