public class BeerSong{
public static void main (String[] args){
int beerNum = 99;
int temp = 0;
String word = "bottles";
while (beerNum > 0) {
System.out.println(beerNum + " " + word + " of beer on the wall" + "," + beerNum + word +" of beer");
beerNum = beerNum - 1;
System.out.println("Take one Down and pass it arround, " + " " + beerNum + " " + word + " of beer on the wall \n");
temp = temp + 1;
if (beerNum == 1) { System.out.println(beerNum + " " + word + " of beer on the wall" + "," + beerNum + word +" of beer");
beerNum = beerNum - 1;
System.out.println("Take one Down and pass it arround, " + " " + "no More " + word + " of beer on the wall \n");
temp = temp + 1;
if (beerNum == 0){
System.out.println("No more" +word + "of beer on the wall, no more " +word + " of beer.");
System.out.println("Go to the store and buy some more " + temp + " " + word + " of beer."); }
}
}
}
}
Tidak ada komentar:
Posting Komentar