How to resolve the algorithm 99 bottles of beer step by step in the Yabasic programming language

Published on 12 May 2024 09:40 PM

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

Source code in the yabasic programming language

sub bottle$(i)
    if i=0 return "no more bottles of beer"
    if i=1 return "1 bottle of beer"
    return str$(i) + " bottles of beer"
end sub

for i = 99 to 1 step -1
    print bottle$(i), " on the wall, \n", bottle$(i), "\n", "take one down, pass it around,\n", bottle$(i - 1), " on the wall.\n"
next

  

You may also check:How to resolve the algorithm AKS test for primes step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Repeat a string step by step in the Sparkling programming language
You may also check:How to resolve the algorithm Palindrome detection step by step in the Z80 Assembly programming language
You may also check:How to resolve the algorithm Non-continuous subsequences step by step in the Perl programming language
You may also check:How to resolve the algorithm Lucas-Lehmer test step by step in the TI-83 BASIC programming language