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