+ 5

[Solved]Unexpected output. Explain why🤔

https://code.sololearn.com/cOMmRPu13WQM/?ref=app Question start on line 30 and ends at line 32

16th Mar 2021, 4:01 PM
!Derrickee
!Derrickee - avatar
3 Respuestas
+ 5
There's nothing unexpected here. Have a look at my code. I have two variables, a = 16 b = 18 Notice the statement : a = ++b Here, b's value is incremented first, since it's a prefix and then a is assigned the value of b. So the final values of a and b are the same, that is, 19. https://code.sololearn.com/cpx40RMR2uSM/?ref=app
16th Mar 2021, 4:15 PM
Soumik
Soumik - avatar
+ 5
So you mean that the output must be the same. I didn't see that coming.Thank you😁
16th Mar 2021, 4:29 PM
!Derrickee
!Derrickee - avatar
+ 3
<Derrickee/> You're Welcome 😄
16th Mar 2021, 4:34 PM
Soumik
Soumik - avatar