回 帖 发 新 帖 刷新版面

主题:关于素数的题向你们请教一下,十万火急呀

请各位大哥大姐关照一下,我实在不会呀,

回复列表 (共19个回复)

11 楼

1不是素数(质数)

[url=http://www.programfan.com/club/showbbs.asp?id=90603]关于质数的检查和计算,请看这一贴[/url]

12 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End

13 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End

14 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End

15 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End

16 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End

17 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End
[em11]

18 楼

on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
           else print("NO Su Shu")
End

19 楼

cls
input n
for i=2 to sqr(n)
if n mod i<>2 then print "n是个素数“
else
print ”n不是个素数“
end if
next i
end

我来回复

您尚未登录,请登录后再回复。点此登录或注册