+ 1

How many times will be the loop execute? What value will be returned?

int x= 2, y=50; do{ ++x; y-=x++; } while(x<=10) return y;

7th Mar 2021, 1:34 PM
Mayank Tiwari
Mayank Tiwari - avatar
2 odpowiedzi
+ 2
You can simply create a code in the playground section and run it if you want to test something. Assuming you fix the missing semicolon and provide the other necessary code, you would find the loop runs five times, returning fifteen at the end.
7th Mar 2021, 1:49 PM
Shadow
Shadow - avatar