VB:产生30个1-100之间的随机数,统计并输出其中奇数和偶数的个数

麻烦各位高手啦!很急,谢谢!

Private Sub Form_Click()
Dim a(30) As Integer
Dim i As Integer
Randomize
For i = 1 To 30
a(i) = Int(100 * Rnd)
Next i

For i = 1 To 30
If a(i) Mod 2 = 0 Then
Text1 = Val(Text1) + 1
Text4 = Text4 & a(i) & vbCrLf
Else
Text2 = Text2 & a(i) & vbCrLf
Text3 = Val(Text3) + 1
End If
Next
End Sub
温馨提示:答案为网友推荐,仅供参考
相似回答