Multiple choice technology programming languages

What will be the output of the following program : void main() { int x=5,y=6,z=2; z/=y/z==3?y/z:x*y; printf("%d",z); }

  1. 0

  2. 1

  3. 2

  4. Compile Time Error

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

y/z equals 3, so y/z==3 is true (1). The ternary operator selects y/z (3). z/=3 is integer division: 2/3 = 0. So z becomes 0. Answer A is correct.

AI explanation

With x=5, y=6, z=2: y/z evaluates to 6/2 = 3, so the condition y/z==3 is true, meaning the ternary selects y/z (which is 3) as the right-hand operand. The statement becomes z /= 3, i.e. z = 2/3, which under integer division truncates to 0. So the printed value is 0.