How to resolve the algorithm Loops/Do-while step by step in the Oberon-2 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Loops/Do-while step by step in the Oberon-2 programming language

Table of Contents

Problem Statement

Start with a value at 0. Loop while value mod 6 is not equal to 0. Each time through the loop, add 1 to the value then print it. The loop must execute at least once.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Loops/Do-while step by step in the Oberon-2 programming language

Source code in the oberon-2 programming language

MODULE LoopDoWhile;
IMPORT  
  Out;

PROCEDURE Do();
VAR
  i: INTEGER;
BEGIN
  i := 0;
  REPEAT
    Out.LongInt(i,0);Out.Ln;
    INC(i)    
  UNTIL (i MOD 6 = 0);
END Do;

BEGIN
  Do
END LoopDoWhile.

  

You may also check:How to resolve the algorithm Stirling numbers of the first kind step by step in the Julia programming language
You may also check:How to resolve the algorithm Archimedean spiral step by step in the Processing programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Commodore BASIC programming language
You may also check:How to resolve the algorithm Stirling numbers of the first kind step by step in the Factor programming language
You may also check:How to resolve the algorithm Mutex step by step in the Objective-C programming language