Language GAP
Date: | 04/20/05 |
Author: | Mike Hoolehan |
URL: | n/a |
Comments: | 0 |
Info: | n/a |
Score: | (2.85 in 13 votes) |
######################################################################### # BottlesOfBeer.g by Mike Hoolehan (mike@sycamorehq.com) # for GAP (http://www-groups.dcs.st-andrews.ac.uk/~gap/) # this is a really silly way to do it, but I want to show off some GAP # Jan 5, 2002 ######################################################################### NumBottles := 99;; BottleRing := ZmodnZ(NumBottles+1);; BottleGenerator := GeneratorsOfRing(BottleRing)[1];; for i in Reversed([1..Size(BottleRing)-1]) do CurrentBottles:=Int(i*BottleGenerator); Print(CurrentBottles, " bottle(s) of residue class beer on the wall.\n"); Print(CurrentBottles, " bottle(s) of residue class beer.\n"); Print("Take one down, reduce the power of the ring generator.\n"); Print(CurrentBottles-1, " bottle(s) of beer on the wall.\n\n"); od
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