一道Vb题

来源:百度知道 编辑:UC知道 时间:2024/05/28 04:06:31
从键盘输入100个整数,统计这些数中奇数,偶数的个数(要求使用INPUTBOX函数和循环结构 在线等…

Private Sub Form_Click()
Dim xO as Integer
Dim xJ as Integer
Dim x(100) as Integer
xO=0
xJ=0
For i=0 to 99
x(i)=Inputbox("Please input the" & i & "integer:")
If x(i) Mod 2=0 then
xO=xO+1
Else
xJ=xJ+1
End If
Next
Print "偶数个数=" & xO
Print "奇数个数=" & xJ
End Sub