private sub command()_click() for i=2 to10 for j=2 toprivate sub command()_click() for i=2 to10 for j=2 to i/2 if imod j then exit for next j if j>sqr(i) then debug.print iend sub 答案为 2 3 5 7 求详解
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 14:32:28
private sub command()_click() for i=2 to10 for j=2 toprivate sub command()_click() for i=2 to10 for j=2 to i/2 if imod j then exit for next j if j>sqr(i) then debug.print iend sub 答案为 2 3 5 7 求详解
private sub command()_click() for i=2 to10 for j=2 to
private sub command()_click()
for i=2 to10
for j=2 to i/2
if imod j then exit for
next j
if j>sqr(i) then debug.print i
end sub
答案为 2 3 5 7 求详解
private sub command()_click() for i=2 to10 for j=2 toprivate sub command()_click() for i=2 to10 for j=2 to i/2 if imod j then exit for next j if j>sqr(i) then debug.print iend sub 答案为 2 3 5 7 求详解
If I mod J = 0 Then Exit For语句的功能是当I能被J整除的时候推出循环,I=2,J=2,I/2=1,J从2到1,不满足条件,退出;执行If J > sqr (I) Then Debug .Print I;因为J> sqr (I),所以Then Debug .Print I ,此时I=2,;I=3,I/2=1.5,打印输入I;I=4,I mod J = 0.退出for循环,但J > sqr (I)也不成立;I=5,J=3,J > sqr (I)成立,输出5…….