How to resolve the algorithm 99 bottles of beer step by step in the NATURAL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm 99 bottles of beer step by step in the NATURAL 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 NATURAL programming language
Source code in the natural programming language
DEFINE DATA
LOCAL
01 #BOTTLES (I2)
END-DEFINE
*
FOR #BOTTLES 99 TO 2 STEP -1
IF #BOTTLES < 98
WRITE #BOTTLES ' BOTTLES OF BEER ON THE WALL'
WRITE ' '
END-IF
*
WRITE #BOTTLES ' BOTTLES OF BEER ON THE WALL'
WRITE #BOTTLES ' BOTTLES OF BEER'
WRITE 'TAKE ONE DOWN, PASS IT AROUND'
END-FOR
*
WRITE '1 BOTTLE OF BEER ON THE WALL'
WRITE ' '
WRITE '1 BOTTLE OF BEER ON THE WALL'
WRITE '1 BOTTLE OF BEER'
WRITE 'TAKE IT DOWN, PASS IT AROUND'
WRITE 'NO MORE BOTTLES OF BEER ON THE WALL'
WRITE ' '
WRITE 'NO MORE BOTTLES OF BEER ON THE WALL'
WRITE 'NO MORE BOTTLES OF BEER'
WRITE 'GO TO THE STORE AND BUY SOME MORE'
WRITE '99 BOTTLES OF BEER'
END
WRITE 'TAKE ONE DOWN, PASS IT AROUND'
*
END
You may also check:How to resolve the algorithm Faces from a mesh step by step in the Raku programming language
You may also check:How to resolve the algorithm Sorting algorithms/Comb sort step by step in the Swift programming language
You may also check:How to resolve the algorithm Successive prime differences step by step in the F# programming language
You may also check:How to resolve the algorithm First-class functions step by step in the REBOL programming language
You may also check:How to resolve the algorithm Stair-climbing puzzle step by step in the FreeBASIC programming language