vf 问题,谁能帮我解释下这个语句

来源:百度知道 编辑:UC知道 时间:2024/06/07 14:45:55
?
??"大小大顺序:"
for i=n to 1 step -2
??x(i)
endfor
if mod(n,2)=0
for i=1 to n step 2
??x(i)
endfor
else
for i=2 to n step 2
??x(i)
endfor
endif
没人告诉吗?

n 未赋初值,程序不能运行!

if mod(n,2)=0
for i=1 to n step 2
??x(i)
endfor
else
for i=2 to n step 2
??x(i)
endfor
endif

mod(n,2)=0除以2取余数,余数为0,也就是说可以整除
可以整除就说明N为偶数,从一开始,也就是打印x(i)数组下标为奇数的值
如果不能整除,说明N为奇数,那么从2开始,也就是打印x(i)数组下标为偶数的值