We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,337 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

flaw in the code

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");
            }
        }
    }

}
2
Contributors
1
Reply
5 Minutes
Discussion Span
8 Months Ago
Last Updated
2
Views
rishabh.sahay.5
Newbie Poster
1 post since Sep 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

what are we looking at/for?

stultuske
Industrious Poster
4,381 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0593 seconds using 2.67MB