int z,x=5,y=-10,a=4,b=2; z=x++ - --y* b/a;
What will be the final value of z?
Answer & ExplanationOption: [C]
The post increment operator is associated with the variable x. So the current variable is considered i.e. x=5.
The pre increment operator is associated with the variable y. So the value of y decreses by 1. That is y=-11.
Multiplication operator and division operator has the same precedence. So the first one is executed first.
So the expression is:
z=5-(-11)*2/4
=5-(-22/4)
=5-(-5)
=10
Article and Schedule Quiz | Start Test! |