用VB编写程序,求三位数的奇数中,所有各位数字之和是12的倍数的数的个数?

问题描述:

用VB编写程序,求三位数的奇数中,所有各位数字之和是12的倍数的数的个数?

Sub test()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim X As Integer
For i = 1 To 9
X = 0
For j = 0 To 9
For k = 0 To 9

If (i * 100 + j * 10 + k) Mod 2 = 1 And (i + j + k) Mod 12 = 0 Then
X = X + 1
End If
Next k
Next j
Next i
MsgBox (X)
End Sub