【VB开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VB开源代码-4.4.1.frm的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
VERSION 5.00
Begin VB.Form Form22
Caption = "Form22"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form22"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
End
Attribute VB_Name = "Form22"
Attribute
VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Click()
Dim i As Integer
Dim m As Integer
m = InputBox("请输入数字", "示例")
'接收用户输入
m = Val(m)
'/m转化为数值数据类型
For i = 2 To m - 1
'从2开始取模
If (m Mod i) = 0 Then
'能够被整除
Print m; "不是素数"
GoTo NotM
'm能被i整除,该m不是素数
End If
Next i
Print m; "是素数"
'm不能被i=2~m-1整除,m是素数,显示
NotM:
End Sub