Sub 素数判定()
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As String
Dim i As Long
d = "素数である"
a = InputBox("a = ")
For i = 2 To Int(Sqr(a))
If a Mod i = 0 Then
b = 1
Exit For
End If
Next i
If b = 1 Then
Call MsgBox(i)
Else
Call MsgBox(d)
End If
End Sub