Advertisement
jwrbg

Task7

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