求出个位数为6,且可以被3整除的三位数有几个 怎么编啊
求出个位数为6,且可以被3整除的三位数有几个 怎么编啊
Dim i As Integer
Private Sub Command1_Click()
Dim s(5) As Long
s(0) = 21321
s(1) = 32126
s(2) = 2126
s(3) = 276 '这个是的
s(4) = 26512
s(5) = 276 '这个是的
Print GetS(s)
End Sub
Function GetS(a() As Long) As Long
Dim tt As Integer
For i = 0 To UBound(a)
If Right(CStr(a(i)), 1) = "6" Then
If Len(CStr(a(i))) = 3 Then
If a(i) Mod 3 = 0 Then
Debug.Print a(i) Mod 3
tt = tt + 1
End If
End If
End If
Next i
GetS = tt
End Function