How to resolve the algorithm 99 bottles of beer step by step in the Oberon-2 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm 99 bottles of beer step by step in the Oberon-2 programming language

Table of Contents

Problem Statement

Display the complete lyrics for the song:     99 Bottles of Beer on the Wall.

The lyrics follow this form: ... and so on, until reaching   0     (zero). Grammatical support for   1 bottle of beer   is optional. As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm 99 bottles of beer step by step in the Oberon-2 programming language

Source code in the oberon-2 programming language

MODULE b99;

IMPORT  Out;

VAR     nr      : INTEGER;

BEGIN
  nr := 99;
  REPEAT
    Out.Int (nr, 4);
    Out.String (" bottles of beer on the wall");
    Out.Ln;
    Out.Int (nr, 4);
    Out.String (" bottles of beer");
    Out.Ln;
    Out.String ("Take one down, pass it around");
    Out.Ln;
    DEC (nr);
    Out.Int (nr, 4);
    Out.String (" bottles of beer on the wall");
    Out.Ln;
    Out.Ln
  UNTIL nr = 0
END b99.

  

You may also check:How to resolve the algorithm Anadromes step by step in the Haskell programming language
You may also check:How to resolve the algorithm System time step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Hello world/Graphical step by step in the HicEst programming language
You may also check:How to resolve the algorithm Matrix transposition step by step in the RLaB programming language
You may also check:How to resolve the algorithm Accumulator factory step by step in the Aime programming language