Language C
(Correct ANSI C containing no semicolons)
Date: | 01/15/09 |
Author: | Steve Checkoway |
URL: | n/a |
Comments: | 0 |
Info: | n/a |
Score: | (3.00 in 46 votes) |
#include <stdio.h> #include <stdlib.h> static void song( int bottles ) { while( (printf("%d bottles of beer on the wall, %d bottles of beer.\n" "Take one down and pass it around, %d bottle%s of beer on the wall.\n\n", bottles, bottles, bottles-1, bottles>2? "s":""), bottles > 2) ) while( (--bottles,0) ) {} while( (puts("1 bottle of beer on the wall, 1 bottle of beer.\n" "Take one down and pass it around, no more bottles of beer on the wall.\n\n" "No more bottles of beer on the wall, no more bottles of beer.\n" "Go to the store and buy some more, 99 bottles of beer on the wall."),0) ) {} } int main() { while( (song(99), exit(0), 0) ) {} }
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
actually produces correct lyrics :P | Dustshine | 08/20/05 | 0 | |
Linux kernel module | Stefan Scheler | 08/02/05 | 15 | |
multithreaded version | Stefan Scheler | 05/11/05 | 4 | |
poor Style | Matteo Casati | 09/01/05 | 6 | |
standard version | Bill Wein | 04/20/05 | 4 |
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