How to resolve the algorithm 99 bottles of beer step by step in the Genie programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm 99 bottles of beer step by step in the Genie 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 Genie programming language
Source code in the genie programming language
[indent=4]
def plural(n:uint):string
return (n == 1) ? "" : "s"
def no(n:uint):string
return (n == 0) ? "No" : n.to_string()
init
bottles:uint = 99;
do
print "%u bottle%s of beer on the wall", bottles, plural(bottles)
print "%u bottle%s of beer", bottles, plural(bottles)
print "Take one down, pass it around"
--bottles
print "%s bottle%s of beer on the wall\n", no(bottles), plural(bottles)
while bottles != 0
You may also check:How to resolve the algorithm Draw a sphere step by step in the Befunge programming language
You may also check:How to resolve the algorithm Terminal control/Hiding the cursor step by step in the Quackery programming language
You may also check:How to resolve the algorithm File input/output step by step in the Nanoquery programming language
You may also check:How to resolve the algorithm Arithmetic evaluation step by step in the Phix programming language
You may also check:How to resolve the algorithm Date format step by step in the LiveCode programming language