How to resolve the algorithm Integer comparison step by step in the Objeck programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Integer comparison step by step in the Objeck 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 Objeck programming language
Source code in the objeck programming language
bundle Default {
class IntCompare {
function : Main(args : String[]) ~ Nil {
a := Console->GetInstance()->ReadString()->ToInt();
b := Console->GetInstance()->ReadString()->ToInt();
if (a < b) {
Console->GetInstance()->Print(a)->Print(" is less than ")->PrintLine(b);
};
if (a = b) {
Console->GetInstance()->Print(a)->Print(" is equal than ")->PrintLine(b);
};
if (a > b) {
Console->GetInstance()->Print(a)->Print(" is greater than ")->PrintLine(b);
};
}
}
}
You may also check:How to resolve the algorithm Elementary cellular automaton step by step in the Peri programming language
You may also check:How to resolve the algorithm Primality by trial division step by step in the min programming language
You may also check:How to resolve the algorithm Loops/Continue step by step in the Suneido programming language
You may also check:How to resolve the algorithm CSV to HTML translation step by step in the Perl programming language
You may also check:How to resolve the algorithm Smarandache prime-digital sequence step by step in the Phix programming language