Language PARI/GP
(Straightforward loop)
| Date: | 05/17/11 |
| Author: | Charles R Greathouse IV |
| URL: | http://math.crg4.com/ |
| Comments: | 0 |
| Info: | http://pari.math.u-bordeaux.fr/ |
| Score: |
forstep(n=99,3,-1,
print(n" bottles of beer on the wall, "n" bottles of beer.");
print("Take one down and pass it around, ",n-1" bottles of beer on the wall.\n")
);
print("2 bottles of beer on the wall, 2 bottles of beer.");
print("Take one down and pass it around, 1 bottle of beer on the wall.\n");
print("1 bottle of beer on the wall, 1 bottle of beer.");
print("Take one down and pass it around, no more bottles of beer on the wall.\n");
print("No more bottles of beer on the wall, no more bottles of beer.");
print("Go to the store and buy some more, 99 bottles of beer on the wall.")
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments