用vb编写输入初始值,输出100个不能被3整除的数

2025-03-22 13:16:42
推荐回答(2个)
回答1:

Sub s()
    i% = InputBox("输入初始值:")
    Do While c < 100
        If i Mod 3 <> 0 Then c = c + 1: Debug.Print i;
        i = i + 1
        If c Mod 10 = 0 Then Debug.Print
    Loop
End Sub

回答2:

Option Explicit
Private Sub Command1_Click()
On Error Resume Next
Dim Str%
Dim i%
Dim Ope
Ope = "C:\1.txt"
Open Ope For Output As #1
Str = InputBox("请输入一个整数", "输入")
Do While (i < 100)
If Str Mod 3 <> 0 Then
Print #1, Str
i = i + 1
End If
Str = Str + 1
Loop
Close #1
End Sub