VB程序:
Private Sub CommandButton1_Click()
do
n = InputBox("请输入一个大于1的正整数","数据输入")
if n>2 then exit do
loop
i = 2
Do
r = n Mod i
i = i + 1
If r = 0 Then
MsgBox (Str(n) + "是质数")
exit sub
end if
if i>=n^0.5 then exit do
Loop
MsgBox (Str(n) + "不是质数")
End Su