关于VB中运算的问题

来源:百度知道 编辑:UC知道 时间:2024/06/20 11:40:07
有这样一个问题请各位帮忙写一下代码: 输出100到200之间不能被3整除的数,要求用DO语句的一种形式来实现,窗口中有Label1和 text1两个控件,要求将不能被3整除的数显示在text1中。
请各位写下代码,一定要用do loop语句。谢谢

Sub test()
Dim i As Integer
Dim str As String
i = 100
str = ""
Do While i <= 200
If i Mod 3 <> 0 Then str = str & CSng(i) & ","
i = i + 1
Loop

text1.text=Left(str, Len(str) - 1)
End Sub

dim i as integer=100
do while i<=200
if i mod 3<>0 then
text1.text=i;
end if
loop

x=100
do while x<200
if x mod 3<>0 then text1=text1 & " " & x
x=x+1
loop

dim i as integer

i=100
do until i>200

if i mod <>0 then text1.text=text1.text & i & " "
i=i+1

loop

dim x as integer=102
do while x<199
if x mod 3<>0 then text1=text1 & " " & x
loop