VB作业求救

来源:百度知道 编辑:UC知道 时间:2024/05/14 06:10:28
输入一个整数,编程判断该数的是奇数还是偶数。

private sub command1_click()
dim a as integer
a=inputbox("请输入一个整数",,66)
if a mod 2=0 then
print a & "是偶数!"
else
print a & "不是偶数!"
end if
end sub

if (text1.text) mod 2 = 0 then
msgbox "偶数"
else
msgbox "奇数"
end if

就是如此