Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Prolog

(Tweaked Remkos version)

Date:11/28/05
Author:M@
URL:n/a
Comments:2
Info:n/a
Score: (3.00 in 48 votes)
% 99 bottles of beer.
% Remko Troncon <spike@kotnet.org>
% Modified by <M@>

bottles :-
    bottles(99).

bottles(1) :- 
    write('1 bottle of beer on the wall, 1 bottle of beer,'), nl,
    write('Take one down, and pass it around,'), nl,
    write('Now they are all gone.'), nl,!.
bottles(X) :-
    write(X), write(' bottles of beer on the wall,'), nl,
    write(X), write(' bottles of beer,'), nl,
    write('Take one down and pass it around,'), nl,
    NX is X - 1,
    write(NX), write(' bottles of beer on the wall.'), nl, nl,
    bottles(NX).

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
ISO Prolog w/ red cutsBrent Spillner04/12/061
iso, using DCGnone04/28/110

Comments

>>  Paul said on 11/20/06 19:33:42

Paul doesn't handle plurals right

>>  Simon Brooke said on 12/20/07 18:09:00

Simon Brooke Verified works with SWI Prolog 5.6.14

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!

Name:

eMail:

URL:

Security Code:
  
Comment: