2个回答
展开全部
Option Explicit
Private Sub Command1_Click()
Dim m As Single, n As String
m = Val(Text1.Text)
If Fix(m) <> m Then
n = MsgBox("请输入整数", 32, "提示")
Text1.Text = ""
Text1.SetFocus
Else
If m Mod 2 = 0 Then Label1.Caption = "此数为偶数"
If m Mod 2 <> 0 Then Label1.Caption = "此数为奇数"
End If
End Sub
代码如上,期待被采纳!
Private Sub Command1_Click()
Dim m As Single, n As String
m = Val(Text1.Text)
If Fix(m) <> m Then
n = MsgBox("请输入整数", 32, "提示")
Text1.Text = ""
Text1.SetFocus
Else
If m Mod 2 = 0 Then Label1.Caption = "此数为偶数"
If m Mod 2 <> 0 Then Label1.Caption = "此数为奇数"
End If
End Sub
代码如上,期待被采纳!
展开全部
Private Sub Command1_Click()
Dim a As Double
a = InputBox("请输入一个整数")
there:
If a = Int(a) Then
Cls
If a / 2 = Int(a / 2) Then
Print "偶数"
Else
Print "奇数"
End If
Else
a = InputBox("请输入一个整数")
GoTo there
End If
End Sub
Dim a As Double
a = InputBox("请输入一个整数")
there:
If a = Int(a) Then
Cls
If a / 2 = Int(a / 2) Then
Print "偶数"
Else
Print "奇数"
End If
Else
a = InputBox("请输入一个整数")
GoTo there
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询