Private Sub Command1_Click()
Dim i%, n%
n = Val(InputBox("输入一个正整数吧!"))
For i = 2 To int (sqr(n - 1))+1
If n Mod i = 0 Then Exit For
Next
MsgBox IIf(i >= int (sqr(n - 1))+1, "yes!", "no!")
End Sub
支持妮可, 不过不想浪费时间和资源
Private Sub Command1_Click()
Dim i%, n%
n = Val(InputBox("输入一个正整数吧!"))
For i = 2 To n - 1
If n Mod i = 0 Then Exit For
Next
MsgBox IIf(i >= n - 1, "yes!", "no!")
End Sub
直接支持妮可。
我没想到变量的妙处。