- #1
Ghost Quartz
- 8
- 4
- TL;DR Summary
- Hi. I'm a beginner in java and was writing code that I expected to generate 15,16,17,18,5,6,7,8 as output, but I received 15,16,17 and 9. I don't understand why.
Java:
int bd= 15;
int ad= 5;
while(ad!=9){
System.out.println(bd);
ad++;
bd++;
}//output 15,16,17,18
do {
System.out.println(ad);
ad++;
}while(ad<=9);//output 5,6,7,8
thanks for the help
Last edited by a moderator: