while loop
i don't understand the output of this program at the start
why the two zero's? how do i change that?
class whileloop
{
publicstaticvoid main(String[] args)
{
int n = 0;int x = 0;
while (n !=10)
{
System.out.println(n);
n++;
while(x !=20)
{
System.out.println(x);
x++;
}
}
}
}
output
0 //the two zeros
0
1
2
3
4
etc
[954 byte] By [
mark_8206a] at [2007-11-26 17:47:54]

> > how do i get rid of the zeros?> > I think this is going nowhere.So do I, but as I really don't want to work...mark, did you read my post above? Do you understand what it says?
mlka at 2007-7-9 5:00:14 >

> i changed the x variable to 1 instead of 0 and now it
> works
> i'm still a little confused but i'll get over it
What are you confused about. You have two loops, one within the other.
Maybe it would help if you change the System.outs to:
System.out.println( "n=" + n );
System.out.println( "x=" + x );
mlka at 2007-7-9 5:00:14 >
