Language C
(actually produces correct lyrics :P)
Date: | 08/20/05 |
Author: | Dustshine |
URL: | n/a |
Comments: | 0 |
Info: | n/a |
Score: | (3.02 in 177 votes) |
#include <stdio.h> int main(void) { int b; for (b = 99; b >= 0; b--) { switch (b) { case 0: printf("No more bottles of beer on the wall, no more bottles of beer.\n"); printf("Go to the store and buy some more, 99 bottles of beer on the wall.\n"); break; case 1: printf("1 bottle of beer on the wall, 1 bottle of beer.\n"); printf("Take one down and pass it around, no more bottles of beer on the wall\n"); break; default: printf("%d bottles of beer on the wall, %d bottles of beer.\n", b, b); printf("Take one down and pass it around, %d %s of beer on the wall.\n" ,b - 1 ,((b - 1) > 1)? "bottles" : "bottle"); break; } } return 0; }
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
Linux kernel module | Stefan Scheler | 08/02/05 | 15 | |
Correct ANSI C containing no semicolons | Steve Checkoway | 01/15/09 | 0 | |
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