Sure! Here’s a simple pseudocode to check if a number is even or odd:
BEGIN
FUNCTION IsEvenOrOdd(number)
IF number MOD 2 = 0 THEN
PRINT "The number is even."
ELSE
PRINT "The number is odd."
ENDIF
END FUNCTION
// Main program
DECLARE number AS INTEGER
PRINT "Enter a number: "
INPUT number
CALL IsEvenOrOdd(number)
END
Explanation:
- The function
IsEvenOrOdd
takes an integer input callednumber
. - It checks if
number
modulo 2 equals 0. If true, the number is even; otherwise, it is odd. - The main program declares a variable to hold the number, prompts the user for input, and then calls the function to determine if the number is even or odd.