Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BeerSong
- {
- public static void main(String[] args)
- {
- int beers = 99;
- while (beers > 0) {
- if (beers > 1) {
- System.out.println(beers + " bottles of beer on the wall, " + beers + " bottles of beer.");
- beers--;
- if (beers == 1) {
- System.out.println("Take one down and pass it around, " + beers + " bottle of beer on the wall.\n");
- }
- else {
- System.out.println("Take one down and pass it around, " + beers + " bottles of beer on the wall.\n");
- }
- }
- else if (beers == 1) {
- System.out.println("1 bottle of beer on the wall, 1 bottle of beer.");
- System.out.println("Take it down and pass it around, no more bottles of beer on the wall.\n");
- beers--;
- System.out.println("No more bottles of beer on the wall, no more bottles of beer.");
- System.out.println("Go to the store and buy some more, 99 bottles of beer on the wall.\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement