by ACMOA (7 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 18th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code is for checking whether a number is even or odd.
API Declarations
DIM NUM2 AS Integer 'Second way to do it
DIM NUM3 AS Integer 'Third way to do it
NUM = InputBox ("Input the number to check:")
If NUM Mod 2 = 0 Then
Print "Even"
Else
Print "Odd"
End If
'Second way
NUM2 = InputBox("Input the number:")
If NUM2 / 2 = Math.Round(NUM2 / 2) Then
Print "Even"
Else
Print "Odd"
End If
'Third way
NUM3 = InputBox("Input the Number:")
If NUM3 / 2 = Int(NUM3 / 2) Then
Print "Even"
Else
Print "Odd"
End If