
-----------------------------------
kims2
Fri Jun 26, 2009 8:17 pm

how do you exit a loop in java?
-----------------------------------
I need to write a program that asks the user for a starting number and an ending number and the program outputs all the numbers inbetween:

example: start value 5, end value 10 = 5 6 7 8 9 10

I've done everything but I do not know how you exit a loop in java. So here's the small problem I have: everytime I enter a higher starting value than the end value. The program will do 5 4 3 2 1 0 1, how do I make it stop at the end value?

This is part of what I have:

[code]        int count = (numberA);
            while (count >= numberB)
                {
                c.println(count);
                count = count - 1;
                }
            while (count 