0

What is the output of this code?

int x = 3; while (x++<10){ x+=2; } cout <<x; After the 3rd iteration isn't the result comes 12?? . I got this code in Sololearn Challenge.. The correct answer shows 13. Can anyone explain?

22nd May 2024, 2:23 AM
Mahmuda Akter Moon
2 Answers
+ 4
Moon you are allowed to try out the code yourself in the Code Playground to see what its output will be. Insert cout statements to see how the variables change inside the loop.
22nd May 2024, 4:46 PM
Brian
Brian - avatar
22nd May 2024, 3:53 PM
Mahmuda Akter Moon