红楼梦的推荐语:VB中输出100-200之间不能被3整除的数

来源:百度文库 编辑:高考问答 时间:2024/04/25 00:35:49

Private Sub Command1_Click()
Dim x As Integer
Dim a As String
For x = 100 To 200
If Int(x / 3) < x / 3 Then
a = a & "," & x
End If
Next
MsgBox "100-200之间不能被3整除的数是" & a
End Sub

补充一下楼上的.

for x=100 to 200
if int(x/3)<x/3 then
msgbox(str(x))
end if
next

dim i as integer
for i=100 to 200
if i mod 3 <>0 then
textbox1.text=textbox1.text & i & " "
end if
next

代码是vb.net,需要一个文本框textbox1

楼上的方法不可取,找到多少个符合条件数字跳出多少个msgbox,你就慢慢按确定吧

我试过了,楼上写的很好啊

我觉得上面几位都给出了结果,但是优劣确实很明显的了!但是我觉得2楼的大哥应该直接在窗体上打印不就行了,如果在Text中输出,还得记得清楚里面原来的初值text
dim i as integer
for i=100 to 200
if i mod 3 <>0 then
print i & " "
end if
next