99 Bottles of Beer Program
A 99 Bottles of Beer Program is a simple Computer Program that used to demonstrate or test Looping Code Segment.
- Context
- It outputs the lyrics to the song "99 Bottles of Beer" [1].
- Example(s):
- Counter-Example(s):
- See: Programming Language, Donald Knuth, Time Complexity, Programming Paradigm.
References
2018a
- (Wikipedia, 2018) ⇒ https://en.wikipedia.org/wiki/99_Bottles_of_Beer#References_in_computer_science Retrieved:2018-5-13.
- The computer scientist Donald Knuth proved that the song has a complexity of [math]\displaystyle{ O(\log N) }[/math] in his in-joke-article “The Complexity of Songs”.
Numerous computer programs exist to output the lyrics to the song. This is analogous to "Hello, World!" programs, with the addition of a loop. As with "Hello World!", this can be a practice exercise for those studying computer programming, and a demonstration of different programming paradigms dealing with looping constructs and syntactic differences between programming languages within a paradigm.
The program has been written in over 1500 different programming languages.
A simple example using classical BASIC syntax:
- The computer scientist Donald Knuth proved that the song has a complexity of [math]\displaystyle{ O(\log N) }[/math] in his in-joke-article “The Complexity of Songs”.
FOR Bottle = 100 TO 1 STEP -1
PRINT STR(Bottle) +” bottles of beer on the wall, “+ STR(Bottle) +” bottles of beer"
PRINT "Take one down and pass it around, “+ STR(Bottle-1) +” bottles of beer on the wall"
NEXT Bottle
2018b
- (Oliver, Gregor & Stefan, 2018) ⇒ "Welcome to 99 Bottles of Beer" http://www.99-bottles-of-beer.net/ Retrieved:2018-5-13
- QUOTE: This Website holds a collection of the Song 99 Bottles of Beer programmed in different programming languages. Actually the song is represented in 1500 different programming languages and variations. For more detailed information refer to historic information.
All these little programs generate the lyrics to the song 99 Bottles of Beer as an output. In case you do not know the song, you will find the lyrics to the song here.
- QUOTE: This Website holds a collection of the Song 99 Bottles of Beer programmed in different programming languages. Actually the song is represented in 1500 different programming languages and variations. For more detailed information refer to historic information.