-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeerSong.java
More file actions
21 lines (18 loc) · 816 Bytes
/
BeerSong.java
File metadata and controls
21 lines (18 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class BeerSong {
public static void main(String[] args) {
int beerNum = 99;
String word = "bottles";
while (beerNum > 1) {
System.out.println(beerNum + " " + word + " of beer on the wall, " + beerNum + " " + word + " of beer.");
beerNum--;
if (beerNum == 1) word = "bottle";
System.out.println("Take one down and pass it around, " + beerNum + " " + word + " of beer on the wall.");
System.out.println();
}
System.out.println("1 bottle of beer on the wall, 1 bottle of beer.");
System.out.println("Take one down and pass it around, no more bottles of beer on the wall.");
System.out.println();
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.");
}
}