Computer Science, asked by sharmarjyoti, 10 months ago

What will be the result stored in x after evaluating the following expression? z+=(++z)+(z++)*z Show the steps.

Answers

Answered by sachinnarang
2

Answer:

12

Explanation:

int z=1;

Firstly:

++z then z=2 its pre-increment and after that z++ its post so value will be assigned first 2*z now z here is 3 (because 2 is assigned and after assignment it becomes 3) 2*3=6+3=9

z=z+9;(z=3)

z=12

so 12 is the answer

Similar questions