跪求 VB编程 编写一个过程,用消息框输出 2-100内的所有偶数

2025-04-25 02:04:44
推荐回答(2个)
回答1:

Public Sub t()

Dim I As Integer
Dim S As String

S = ""
For I = 2 To 100 Step 2
S = S & I & " "
Next I

MsgBox S

End Sub

回答2:

for i=2 to 200
if i mod 2=0 then
if t=5 then
t=0
result=result & cstr(i) & vbcrlf
else
result=result & cstr(i) & chr(32)
t=t+1
endif
endif
next
msgbox result