VB程序求出各位数为6且能被3整除的三位数共有多少个?
1个回答

建个按钮控件:(下程序还可以显示每个数)

'VB程序求出各位数为6且能被3整除的三位数共有多少个?

Private Sub Command1_Click()

Dim cout As Integer

For i = 100 To 999

If i Mod 10 = 6 And i Mod 3 = 0 Then

Print i;

cout = cout + 1

If cout Mod 5 = 0 Then

Print

End If

End If

Next

Print cout;"个"

End Sub

------------------

下面这个只能求个数

'VB程序求出各位数为6且能被3整除的三位数共有多少个?

Private Sub Command1_Click()

Dim cout As Integer

For i = 100 To 999

If i Mod 10 = 6 And i Mod 3 = 0 Then

cout = cout + 1

End If

Next

Print cout; "个"

End Su