How to resolve the algorithm 99 bottles of beer step by step in the N/t/roff programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm 99 bottles of beer step by step in the N/t/roff 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 N/t/roff programming language

Source code in the n/t/roff programming language

.nr BS 99 1
.de L1
.ie \\n(BS>1 \{ \
\\n(BS bottles of beer on the wall,
\\n(BS bottles of beer.\c
\}
.el \{ \
\\n(BS bottle of beer on the wall,
\\n(BS bottle of beer.\c
\}
Take one down, pass it around,
\\n-(BS bottles of beer on the wall.

.if \\n(BS>0 .L1
..
.nf
.L1
.fi

.nr beers 99 1
.nf
.while \n[beers]>0 \{ \
.ie \n[beers]>1 \{ \
\n[beers] bottles of beer on the wall,
\n[beers] bottles of beer.\c
\} \" ie \n[beers]>1
.el \{ \
\n[beers] bottle of beer on the wall,
\n[beers] bottle of beer.\c
\} \" el
Take one down, pass it around,
\n-[beers] bottles of beer on the wall.
\} \" while \n[beers]>0
.fi

  

You may also check:How to resolve the algorithm Anti-primes step by step in the langur programming language
You may also check:How to resolve the algorithm Hello world/Web server step by step in the REALbasic programming language
You may also check:How to resolve the algorithm Draw a sphere step by step in the C# programming language
You may also check:How to resolve the algorithm Matrix digital rain step by step in the REXX programming language
You may also check:How to resolve the algorithm Anagrams/Deranged anagrams step by step in the TUSCRIPT programming language