Skip to content

Instantly share code, notes, and snippets.

@vitaliiSmokov
Created May 14, 2014 19:51
Show Gist options
  • Save vitaliiSmokov/7694f125ce802c770b8d to your computer and use it in GitHub Desktop.
Save vitaliiSmokov/7694f125ce802c770b8d to your computer and use it in GitHub Desktop.
BotlesOfBeer
/**
* 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