How to resolve the algorithm Integer comparison step by step in the Seed7 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Integer comparison step by step in the Seed7 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 Seed7 programming language

Source code in the seed7 programming language

$ include "seed7_05.s7i";

const proc: main is func
  local
    var integer: a is 0;
    var integer: b is 0;
  begin
    readln(a);
    readln(b);

    if a < b then
      writeln(a <& " is less than " <& b);
    end if;

    if a = b then
      writeln(a <& " is equal to " <& b);
    end if;

    if a > b then
      writeln(a <& " is greater than " <& b);
    end if;
  end func;

  

You may also check:How to resolve the algorithm Formal power series step by step in the C programming language
You may also check:How to resolve the algorithm Barnsley fern step by step in the Swift programming language
You may also check:How to resolve the algorithm User input/Graphical step by step in the Scratch programming language
You may also check:How to resolve the algorithm Sieve of Eratosthenes step by step in the LiveCode programming language
You may also check:How to resolve the algorithm A+B step by step in the Ultimate++ programming language