VB程序设计题目!!
发布网友
发布时间:2022-12-31 22:33
我来回答
共1个回答
热心网友
时间:2023-11-04 10:55
Private Function Even(intData() As Integer) As Long
Dim i As Long, sum As Long, ic As Long
sum = 0
ic = 0
For i = LBound(intData) To UBound(intData)
If ((intData(i) Mod 2) = 0) Then
sum = sum + intData(i)
ic = ic + 1
End If
Next
Even = sum / ic
End Function
Private Sub Form_Click()
Dim intData(9) As Integer, i As Integer
Randomize
Me.Cls
For i = 0 To 9
intData(i) = 1 + CInt(99 * Rnd)
Next
Me.Print Even(intData)
End Sub