Multiple choice technology programming languages

What will be the values of x and y? { int x = 5; int y = 10; y += x++; System.Console.WriteLine("x:" + x.toString() + " y:" + y.toString()); }

  1. x: 6 y: 16

  2. x: 10 y: 26

  3. x: 10 y: 15

  4. x: 6 y: 15

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

The postfix increment operator x++ evaluates to the current value of x (which is 5) before incrementing it to 6. Thus, y += 5 sets y to 15, and x is updated to 6, matching the correct output.