+ 1
Please explain working of this loop.
Actually it's output is 21. how anybody tell me it's inner working. https://code.sololearn.com/cK7R6PkhI0gt/?ref=app
5 Answers
+ 13
When loop runs 1st time,
x=3; x=x+5; x++; means x=9 (3<17)
When loop runs 2nd time,
x=9; x=x+5; x++; means x=15 (9<17)
When loop runs 3rd time,
x=15; x=x+5; x++; means x=21 (15<17)
and now since x=21>17
loop breaks.
+ 11
you forget x++, present inside the loop. It will also run
+ 2
x=3
x=x+5
x=8
how x=9
+ 2
sorry now understand
+ 2
thankyou so much đ