VB编程 。 单击按钮command1时输入一个整数,判断它能否被9,11,13整除,并输出相应的信息
1个回答
展开全部
Private Sub Command1_Click()
Dim a As Single
Dim b As String
a = InputBox("请输入一个数")
If a Mod 9 = 0 Then
b = b & "能被9整除" & vbCr
End If
If a Mod 11 = 0 Then
b = b & "能被11整除" & vbCr
End If
If a Mod 13 = 0 Then
b = b & "能被13整除" & vbCr
End If
If a Mod 9 <> 0 And a Mod 11 <> 0 And a Mod 13 <> 0 Then
b = "不能被9,11,13整除"
End If
MsgBox b
End Sub
Dim a As Single
Dim b As String
a = InputBox("请输入一个数")
If a Mod 9 = 0 Then
b = b & "能被9整除" & vbCr
End If
If a Mod 11 = 0 Then
b = b & "能被11整除" & vbCr
End If
If a Mod 13 = 0 Then
b = b & "能被13整除" & vbCr
End If
If a Mod 9 <> 0 And a Mod 11 <> 0 And a Mod 13 <> 0 Then
b = "不能被9,11,13整除"
End If
MsgBox b
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询