sub form_click()
dim n As Integer
n=inputbox("输入一个正数:")
k=int(sqr(n))
i=2
ab=0
while i<=k and ab=0
if n mod i=0 then
ab=1
else
i=i+1
end if
wend
if ab=0 then
print n;"是素数"
else
print n;"不是素数"
end if
end sub
北京中亚电脑学校提供VB培训
http://www.zhongya.com.cn
dim n As Integer
n=inputbox("输入一个正数:")
k=int(sqr(n))
i=2
ab=0
while i<=k and ab=0
if n mod i=0 then
ab=1
else
i=i+1
end if
wend
if ab=0 then
print n;"是素数"
else
print n;"不是素数"
end if
end sub
北京中亚电脑学校提供VB培训
http://www.zhongya.com.cn