vb求出100~200之间,能被5整除,但不能被3整除的数,

2024-12-16 02:32:43
推荐回答(2个)
回答1:

Private Sub Command1_Click()
Dim a As Integer
For a = 100 To 200 Step 1
If a Mod 5 = 0 And a Mod 3 <> 0 Then
Print a
End If
Next a
End Sub

回答2:

Dim i As Integer
Dim a As String = ""
For i = 100 To 200
If i Mod 5 = 0 And i Mod 3 <> 0 Then
a = a & " ," & i
End If
Next
Next