VB编程填空题目:偶数的个数

来源:百度知道 编辑:UC知道 时间:2024/05/27 10:06:37
统计在随机产生的10个两位整数中的偶数的个数并用消息框输出
Public Sub countEven()
Dim a(9) As Integer
Dim count As Integer
Dim i As Integer, n As Integer
Randomize
'***错误1***
For i =____________To______________
'***错误2***
n = Int(Rnd * 90_____________)
a(i) = n
Form1.Print a(i)
If a(i) Mod 2 = 0 Then
count = count + 1
End If
Next i
'***错误3***
MsgBox ("偶数个数:"_______________ count)
End Sub

0
9
10
&

For i =0 To 9
n = Int(Rnd * 90 + 10)
MsgBox ("偶数个数:" & count)

Public Sub countEven()
Dim a(9) As Integer
Dim count As Integer
Dim i As Integer, n As Integer
Randomize
For i =_____0_______To______9________
n = Int(Rnd * 90______+10_______)
a(i) = n
Form1.Print a(i)
If a(i) Mod 2 = 0 Then
count = count + 1
End If
Next i
MsgBox ("偶数个数:"_______&________ count)
End Sub