You have defined bott_num as
int bott_num = 9;
So it will start with 9 but your print:
System.out.println("there'll be " + (bott_num - 1) + " green bottles, hanging on the wall");
prints bott_num - 1
which in your case would be 8. So i would sugges you start with 11 so you will get output like:
11 green bottles, hanging on the wall,
..
there'll be 10 green bottles, hanging on the wall
While if you want consistent result, then you could initialize it to 10 and change your print statement to:
System.out.println("there'll be " + bott_num + " green bottles, hanging on the wall");
Also your second while loop, is going to execute just once instead of starting say from 10 as you are decrementing bott_num
in your while loop 1, so may be you could have temp variable that’s assigned same value as bott_num
and you decrement that variable rather than bott_num
itself.
5
solved Java Class wont notice numbers over 9 [closed]