x mod 2=1 x mod 3=2 x mod 4=3 x mod 5=4 x mod 6=5 x mod 7=0 求x的最小值!
x mod 2=1 x mod 3=2 x mod 4=3 x mod 5=4 x mod 6=5 x mod 7=0 求x的最小值!
[解决办法]
Private Sub Command1_Click()
Dim x As Long
For x = 30 To 30 * 30 Step 30
If x Mod 7 = 1 Then
'求x的最小值!
MsgBox CStr(x - 1)
Exit For
End If
Next
End Sub
[解决办法]
Dim x As Long
Do While True
If x Mod 2 = 1 And x Mod 3 = 2 And x Mod 4 = 3 And x Mod 5 = 4 And x Mod 6 = 5 And x Mod 7 = 0 Then Exit Do
x = x + 1
Loop
Debug.Print x
呵呵!