Created
May 14, 2014 19:51
-
-
Save vitaliiSmokov/7694f125ce802c770b8d to your computer and use it in GitHub Desktop.
BotlesOfBeer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Vitalik on 05.05.2014. | |
*/ | |
public class BotlesOfBeer | |
{ | |
public static void main(String[] args){ | |
int k = 99; | |
while (k > 0){ | |
System.out.printf( | |
"%d bottle%s of beer on the wall ,\n" + | |
"%d bottle%s of beer ,\n" + | |
"take one down , pass it around ,\n" + | |
"%d bottle%s of beer on the wall.\n\n" , | |
k, | |
(( k != 1) ? "s" : "") , | |
k , | |
(( k != 1) ? "s" : ""), | |
--k , | |
(( k != 1) ? "s" : "") | |
); | |
} | |
System.out.println("No more bottles of beer on the wall!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment