Last active
November 3, 2016 13:47
-
-
Save guaracy/c4e240d68f4894d01c14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
identification division. | |
program-id. 99-bottles. | |
data division. | |
working-storage section. | |
77 max pic 9(02) value 99. | |
77 bottle-word pic x(07). | |
77 bottles pic 99. | |
88 too-drunk value 0. | |
procedure division. | |
perform varying bottles from max by -1 until too-drunk | |
if bottles = 1 | |
move "bottle" to bottle-word | |
else | |
move "bottles" to bottle-word | |
end-if | |
if bottles not equal max | |
display "Take one down and pass it arround" | |
display bottles " " bottle-word " of beer on the wall." | |
display " " | |
end-if | |
display bottles " " bottle-word " of beer on the wall" | |
display bottles " " bottle-word " of beer" | |
end-perform. | |
display "Take one down and pass it arround" | |
display "No more bottles of beer on the wall." | |
display " " | |
display "Go to the store and buy some more " | |
display max " bottles of beer on the wall.". | |
stop run. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment