consider the following:\nint x = 100;\nwhile( x -= 10 ){\nprintf( \i cant sleep. the clowns are chasing…

consider the following:\nint x = 100;\nwhile( x -= 10 ){\nprintf( \i cant sleep. the clowns are chasing me.\\n\ );\n}\n2. what will the value of \x\ be after weve completely exited the while() loop statement?\n0\n5\n-1\n2

consider the following:\nint x = 100;\nwhile( x -= 10 ){\nprintf( \i cant sleep. the clowns are chasing me.\\n\ );\n}\n2. what will the value of \x\ be after weve completely exited the while() loop statement?\n0\n5\n-1\n2

Answer

Explanation:

Step1: Analyze while - loop condition

The while loop condition x -= 10 is an assignment - expression in C. It first subtracts 10 from x and then returns the new value of x. The loop continues as long as the value of the expression (new value of x) is non - zero.

Step2: Track value of x

Initial value of x is 100. First iteration: x = 100 - 10=90 (loop continues). Second iteration: x = 90 - 10 = 80 (loop continues). ... Tenth iteration: x = 10 - 10=0 (loop condition fails as 0 is false in C for loop conditions).

Answer:

0