分别使用VBScript的Do While…Loop 和Do Until …Loop语句编写计算112+122+132+…
1个回答
展开全部
dim he,i
he = 0
i = 1
do until i > 1000
if i mod 7 <> 0 then
he = he + i
end if
i = i + 1
loop
msgbox he
'======================
dim he,i
he = 0
i = 1
for i = 1 to 1000
if i mod 7 <> 0 then
he = he + i
end if
next
msgbox he
'======================
dim he,i
he = 0
i = 1
while i <= 1000
if i mod 7 <> 0 then
he = he + i
end if
i = i + 1
wend
msgbox he
he = 0
i = 1
do until i > 1000
if i mod 7 <> 0 then
he = he + i
end if
i = i + 1
loop
msgbox he
'======================
dim he,i
he = 0
i = 1
for i = 1 to 1000
if i mod 7 <> 0 then
he = he + i
end if
next
msgbox he
'======================
dim he,i
he = 0
i = 1
while i <= 1000
if i mod 7 <> 0 then
he = he + i
end if
i = i + 1
wend
msgbox he
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询