Private Sub Form_Load()
Dim a As Long
Dim b As Long
Dim c As Long
Dim Time1 As Single
Dim Time2 As Single
Dim Time3 As Single
Time1 = Timer
For c = 0 To 50000000
a = 1
Next c
Time1 = Timer - Time1
Time2 = Timer
For c = 0 To 50000000
a = 5 And 1
Next c
Time2 = Timer - Time2 - Time1
Time3 = Timer
For c = 0 To 50000000
a = 5 Mod 2
Next c
Time3 = Timer - Time3 - Time1
MsgBox Round(Time2, 4) & vbNewLine & Round(Time3, 4)
Print a
End Sub
Private Function IsEven(Number As Long) As Boolean
If Right(Number, 1) = 0 Or Right(Number, 1) = 2 Or Right(Number, 1) = 4 Or Right(Number, 1) = 6 Or Right(Number, 1) = 8 Then IsEven = True Else IsEven = False
End Function
Private Sub Command1_Click()
If IsEven(Text1.Text) Then MsgBox "Чётное" Else MsgBox "Нечётное"
End Sub
Сейчас этот форум просматривают: AhrefsBot, Yandex-бот и гости: 3