Dim i As LongDim Count As LongFor i = 1 To 100If (i Mod 3 = 0) And (i Mod 2 = 0) ThenCount = Count + 1Debug.Print iEnd IfNextMsgBox Count答案是16两个条件,能被3整除并且是偶数
VB题 枚举算法 请计算自然数100以内的能被3整除的偶数的个数.
Dim i As LongDim Count As LongFor i = 1 To 100If (i Mod 3 = 0) And (i Mod 2 = 0) ThenCount = Count + 1Debug.Print iEnd IfNextMsgBox Count答案是16两个条件,能被3整除并且是偶数