How to resolve the algorithm 99 bottles of beer step by step in the Modula-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 Modula-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 Modula-2 programming language
Source code in the modula-2 programming language
MODULE b99;
IMPORT InOut;
VAR nr : CARDINAL;
BEGIN
nr := 99;
REPEAT
InOut.WriteCard (nr, 4);
InOut.WriteString (" bottles of beer on the wall");
InOut.WriteLn;
InOut.WriteCard (nr, 4);
InOut.WriteString (" bottles of beer");
InOut.WriteLn;
InOut.WriteString ("Take one down, pass it around");
InOut.WriteLn;
DEC (nr);
InOut.WriteCard (nr, 4);
InOut.WriteString (" bottles of beer on the wall");
InOut.WriteLn;
InOut.WriteLn
UNTIL nr = 0
END b99.
You may also check:How to resolve the algorithm Array concatenation step by step in the ATS programming language
You may also check:How to resolve the algorithm Remove duplicate elements step by step in the Sparkling programming language
You may also check:How to resolve the algorithm Calendar - for REAL programmers step by step in the PHP programming language
You may also check:How to resolve the algorithm Show ASCII table step by step in the Red programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Whiley programming language