99 Bottles of Beer computer program |
A 99 Bottles of Beer computer program is a common programming language exercise. The idea is to program a routine writing out the full lyrics of 99 Bottles of Beer .
= ABAP =
data counter type i value 99. do 99 times. write: /(2) counter, bottles of beer on the wall , /(2) counter, bottles of beer! , / Take one down, pass it around. . subtract 1 from counter. if counter ge 1. write: /(2) counter, bottles of beer on the wall! . else. write / No more bottles of beer on the wall! . endif. skip 2. enddo.
= Batch file =
@echo off set now=99 set multi=s del bottles.txt :loop >> bottles.txt echo %now% bottle%multi% of beer on the wall >> bottles.txt echo %now% bottle%multi% of beer! >> bottles.txt echo Take one down, pass it around. set /a now=now-1 echo %now% LEFT >> bottles.txt echo %now% bottles of beer on the wall! if %now%==1 set multi= if %now% GEQ 1 goto loop >> bottles.txt echo No more bottles of beer on the wall! start bottles.txt exit
= BlitzBasic =
For i=99 To 2 Step -1 Print i + bottles of beer on the wall Print i + bottles of beer! Print Take one down, pass it around. + (i - 1) + bottles of beer on the wall! Next Print 1 bottle of beer on the wall Print 1 bottle of beer! Print Take it down, pass it around. No more bottles of beer on the wall!
= Boo programming language =
s= s for i in range(99, 1): if i 1; --i) { cout|
|