How to resolve the algorithm Integer comparison step by step in the ALGOL 68 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Integer comparison step by step in the ALGOL 68 programming language
Table of Contents
Problem Statement
Get two integers from the user. Then, display a message if the first integer is: the second integer.
Test the condition for each case separately, so that all three comparison operators are used in the code.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Integer comparison step by step in the ALGOL 68 programming language
Source code in the algol programming language
main: (
INT a, b;
read((a, space, b, new line));
IF a <= b OR a LE b # OR a ≤ b # THEN
print((a," is less or equal to ", b, new line))
FI;
IF a < b OR a LT b THEN
print((a," is less than ", b, new line))
ELIF a = b OR a EQ b THEN
print((a," is equal to ", b, new line))
ELIF a > b OR a GT b THEN
print((a," is greater than ", b, new line))
FI;
IF a /= b OR a NE b # OR a ≠ b # THEN
print((a," is not equal to ", b, new line))
FI;
IF a >= b OR a GE b # OR a ≥ b # THEN
print((a," is greater or equal to ", b, new line))
FI
)
You may also check:How to resolve the algorithm Sorting algorithms/Quicksort step by step in the Crystal programming language
You may also check:How to resolve the algorithm Zero to the zero power step by step in the APL programming language
You may also check:How to resolve the algorithm Text processing/2 step by step in the jq programming language
You may also check:How to resolve the algorithm Sorting algorithms/Insertion sort step by step in the Ursala programming language
You may also check:How to resolve the algorithm Sorting algorithms/Radix sort step by step in the C# programming language