vf 判断一个大于等于3的自然数是否为素数clearinput “请输入自然数( > = 3) :” to nf = 0i = 2do while i < = int(sqrt(n))if mod(n,1) < > 0i = i + 1loopelsef = 1exitendifenddoif f = 0str(n,1) + “是素数”elsestr(n,1) + “
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/17 10:26:13
![vf 判断一个大于等于3的自然数是否为素数clearinput “请输入自然数( > = 3) :” to nf = 0i = 2do while i < = int(sqrt(n))if mod(n,1) < > 0i = i + 1loopelsef = 1exitendifenddoif f = 0str(n,1) + “是素数”elsestr(n,1) + “](/uploads/image/z/1663377-33-7.jpg?t=vf+%E5%88%A4%E6%96%AD%E4%B8%80%E4%B8%AA%E5%A4%A7%E4%BA%8E%E7%AD%89%E4%BA%8E3%E7%9A%84%E8%87%AA%E7%84%B6%E6%95%B0%E6%98%AF%E5%90%A6%E4%B8%BA%E7%B4%A0%E6%95%B0clearinput+%E2%80%9C%E8%AF%B7%E8%BE%93%E5%85%A5%E8%87%AA%E7%84%B6%E6%95%B0%28+%3E+%3D+3%29+%EF%BC%9A%E2%80%9D+to+nf+%3D+0i+%3D+2do+while+i+%3C+%3D+int%28sqrt%28n%29%29if+mod%28n%2C1%29+%3C+%3E+0i+%3D+i+%2B+1loopelsef+%3D+1exitendifenddoif+f+%3D+0str%28n%2C1%29+%2B+%E2%80%9C%E6%98%AF%E7%B4%A0%E6%95%B0%E2%80%9Delsestr%28n%2C1%29+%2B+%E2%80%9C)
xRN@Y&"Jl:R,]QAB@@F/hf<3&[6;s9ckhf;$Iԧl$kpN&{K|,]sfDsesŖSН5E;)