0

[SOLVED] Guys why it doesnt stop in 10 ?

I tried do an other loop,and it go until 11,but i said him go until 10 i will put the link for you see https://code.sololearn.com/cA1tQft1AN68/?ref=app

3rd May 2021, 10:43 AM
Katdotbrush
Katdotbrush - avatar
5 Respostas
+ 2
Just swap the position of print and increment statement
3rd May 2021, 10:46 AM
YUGRAJ
+ 1
At 10 it pass the condition then it increments to 11 and then you printed it so that's why 11 is there
3rd May 2021, 10:45 AM
YUGRAJ
+ 1
because you increment i before you print it in the while loop. print it first and it will stop at 10
3rd May 2021, 10:46 AM
Slick
Slick - avatar
0
When i is 10. 10 <= 10 is true. Thus 11 is printed.
3rd May 2021, 10:51 AM
你知道規則,我也是
你知道規則,我也是 - avatar