What is the output of code? void main ()
What is the output of code?
void main ()
{
int x = 33, y, z;
z = x++ + 17;
y = ++z − ++x;
cout << "x" << x << "y" << y << "z" << z;
}
Show answerHide answer
Correct answer: (B) x = 35 y = 16 z = 51
Explanation
z = x++ + 17 = 33 + 17 = 50 and x becomes 34. y = ++z − ++x = 51 − 35 = 16. So x = 35, y = 16, z = 51.