public class NewClass {
public static void main(String[]args){
int beerNUM = 99;
String word = "bottles";
while (beerNum>0){
if (beerNum == 1){
word = "bottles";
}
System.out.println(beerNum + " " + word + "of beer on the wall");
System.out.println(beerNum + " " + word + "of beer.");
System.out.println("take one down");
System.out.println("pass it around");
beerNum = beerNum - 1;
if (beerNum > 0){
System.out.println(beerNum + " " + word + "of beer on the wall");
}
else{
System.out.println("no more bottles of beer on the wall");
}
}
}
}
rishabh.sahay.5
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.