Advertisement
kocev

Beers

Feb 19th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. public class Beers {
  2.     public static void main(String[] args) {
  3.         for (int i = 99; i > 0; i--) {
  4.             if (i == 1) {
  5.                 System.out.printf("%d bottles of beer on the wall, %d bottles of beer.%nTake one down and pass it around, no more bottles of beer on the wall.%n", i, i);
  6.                 break;
  7.             }
  8.             System.out.printf("%d bottles of beer on the wall, %d bottles of beer.%nTake one down and pass it around, %d bottles of beer on the wall.%n", i, i, i-1);
  9.  
  10.         }
  11.         System.out.printf("No more bottles of beer on the wall, no more bottles of beer.%nGo to the store and buy some more, 99 bottles of beer on the wall.%n");
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement