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/06/25 20:24:24
![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 求详解](/uploads/image/z/12765666-66-6.jpg?t=private+sub+command%EF%BC%88%EF%BC%89_click%EF%BC%88%EF%BC%89+for+i%3D2+to10+for+j%3D2+toprivate+sub+command%EF%BC%88%EF%BC%89_click%EF%BC%88%EF%BC%89+for+i%3D2+to10++++for+j%3D2+to+i%2F2+if+imod+j+then+exit+for+next+j+if+j%3Esqr%28i%29+then+debug.print+iend+sub++%E7%AD%94%E6%A1%88%E4%B8%BA+2+3+5+7+%E6%B1%82%E8%AF%A6%E8%A7%A3)
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…….