VB中1到1000间,是奇数就加,偶数就乘这之类的题目

来源:百度知道 编辑:UC知道 时间:2024/06/04 17:12:53
考试很紧!!!!!
快啊
高手来帮帮忙!

static rs as intger
rs=1
for i=1 to 1000
if i mod 2 =0 then
i=rs*i
else
i=rs+i
end if
next
'rs即是要求的结果

啊?跳着来啊 for i=1 to 999 step 2 ... next i
for j=2 to 1000 step 2 ... next j。让问题简化。

两个for 搞定了