Here's the source:
Code:
#include<stdio.h>
int main() {
int i=99;
for (i;i!=2;i--) {
printf("\n\n%d bottles of beer on the wall, %d bottles of beer.",i,i);
printf("\nYou take one down, and pass it around, %d bottles of beer on the wall!",i-1);
}
// Number of bottles of beer on the wall is too low to be grammatically
// correct, last two lines (verses?) will be printed the lazy way.
printf("\n\n2 bottles of beer on the wall, 2 bottles of beer.");
printf("\nYou take one down, and pass it around, 1 bottle of beer on the wall!");
printf("\n\n1 bottle of beer on the wall, 1 bottle of beer.");
printf("\nYou take one down, and pass it around, no more bottles of beer on the wall!\n\n");
return 0;
}
Last 3 'lines' of output:
Code:
3 bottles of beer on the wall, 3 bottles of beer.
You take one down, and pass it around, 2 bottles of beer on the wall!
2 bottles of beer on the wall, 2 bottles of beer.
You take one down, and pass it around, 1 bottle of beer on the wall!
1 bottle of beer on the wall, 1 bottle of beer.
You take one down, and pass it around, no more bottles of beer on the wall!
?@?~/c/boredom$ _
Thank you all for your help, I hope this leaves you all feeling accomplished... or at least a little tipsy :P
I seriously just started messing around with C two days ago, last night being the first try at doing anything beyond printing strings. Now that I understand the variable printing system a little better after reading a OUCS (Oxford University Computer Services) 'primer' after a google search, C is a little easier for me
Just don't be expecting me to program an o/s anytime soon. Cheers all.
Edit: Next on the menu is file manipulation (input/output etc.). It's gonna be fun!!!