1/* 2 * beer - 99 bottles of beer 3 * 4 * Copyright (C) 1999 Landon Curt Noll 5 * 6 * Calc is open software; you can redistribute it and/or modify it under 7 * the terms of the version 2.1 of the GNU Lesser General Public License 8 * as published by the Free Software Foundation. 9 * 10 * Calc is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 * Public License for more details. 14 * 15 * A copy of version 2.1 of the GNU Lesser General Public License is 16 * distributed with calc under the filename COPYING-LGPL. You should have 17 * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 * 20 * Under source code control: 1996/11/13 13:21:05 21 * File existed as early as: 1996 22 * 23 * chongo <was here> /\oo/\ http://www.isthe.com/chongo/ 24 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 */ 26 27/* 28 * See: http://www.ionet.net/~timtroyr/funhouse/beer.html#calc 29 */ 30 31 32for (i=99; i > 0;) { 33 /* current wall state */ 34 some_bottles = (i != 1) ? "bottles" : "bottle"; 35 print i, some_bottles, "of beer on the wall,",; 36 print i, some_bottles, "of beer!"; 37 38 /* glug, glug */ 39 --i; 40 print "Take one down and pass it around,",; 41 42 /* new wall state */ 43 less = (i > 0) ? i : "no"; 44 bottles = (i!=1) ? "bottles" : "bottle"; 45 print less, bottles, "of beer on the wall!\n"; 46} 47