How to resolve the algorithm Even or odd step by step in the ALGOL 68 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Even or odd step by step in the ALGOL 68 programming language

Table of Contents

Problem Statement

Test whether an integer is even or odd. There is more than one way to solve this task:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Even or odd step by step in the ALGOL 68 programming language

Source code in the algol programming language

# Algol 68 has a standard operator: ODD which returns TRUE if its integer  #
# operand is odd and FALSE if it is even                                   #
# E.g.:                                                                    #

INT n;
print( ( "Enter an integer: " ) );
read( ( n ) );
print( ( whole( n, 0 ), " is ", IF ODD n THEN "odd" ELSE "even" FI, newline ) )

  

You may also check:How to resolve the algorithm Index finite lists of positive integers step by step in the Quackery programming language
You may also check:How to resolve the algorithm Sorting algorithms/Bogosort step by step in the Action! programming language
You may also check:How to resolve the algorithm Power set step by step in the AppleScript programming language
You may also check:How to resolve the algorithm Call a foreign-language function step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Loops/Downward for step by step in the E programming language