0

can anyone explain why the output is 6

I've been studying loops and am finding this topic very confusig.Please help me understand this output and if u can than plz do explain the other loops.Plz suggest other websites to clear up this topic. https://code.sololearn.com/W8997iTGrxM6/?ref=app

3rd Jan 2020, 2:43 PM
Bald Bear
Bald Bear - avatar
4 Answers
0
In the last iteration when x becomes 5, then 5<6 is true and the while loop is executed so now after post increment your x becomes 6. Since 6<6 is false, it comes out of the loop and prints it.
3rd Jan 2020, 2:45 PM
Avinesh
Avinesh - avatar
0
am confused about the thing that in the beginning x has been declared a value of 0 and x < 6 why would it print value 6 and if it is a loop than why isn't the output 1 2 3 4 5 6 why 6 onlyy.Plz help
3rd Jan 2020, 2:50 PM
Bald Bear
Bald Bear - avatar