Advertisement
Guest User

BeerSong

a guest
Feb 19th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. public class BeerSong
  2. {
  3.   public static void main(String[] args)
  4.   {
  5.     int beers = 99;
  6.  
  7.     while (beers > 0) {
  8.       if (beers > 1) {
  9.         System.out.println(beers + " bottles of beer on the wall, " + beers + " bottles of beer.");
  10.  
  11.         beers--;
  12.         if (beers == 1) {
  13.           System.out.println("Take one down and pass it around, " + beers + " bottle of beer on the wall.\n");
  14.         }
  15.         else {
  16.           System.out.println("Take one down and pass it around, " + beers + " bottles of beer on the wall.\n");
  17.         }
  18.       }
  19.       else if (beers == 1) {
  20.         System.out.println("1 bottle of beer on the wall, 1 bottle of beer.");
  21.         System.out.println("Take it down and pass it around, no more bottles of beer on the wall.\n");
  22.  
  23.         beers--;
  24.  
  25.         System.out.println("No more bottles of beer on the wall, no more bottles of beer.");
  26.         System.out.println("Go to the store and buy some more, 99 bottles of beer on the wall.\n");
  27.       }
  28.     }
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement