Computer Science, asked by sabah13, 28 days ago

Give the output for the expression y=++x-x++ if x=10.​

Answers

Answered by kamalrajatjoshi94
12

Answer:

int x=10

y=++x-x++

y=11-11

y=0

Answered by anindyaadhikari13
4

Required Answer:-

Given:

  • x = 10
  • y = ++x - x++

To Find:

  • The final values of x and y.

Solution:

It's given that,

>> x = 10

>> y = ++x - x++

>> y = 11 - x++ [Pre-increment, so x becomes 11]

>> y = 11 - 11 [Post-increment, value of x is placed in the expression and then incremented]

>> y = 11 - 11 [x becomes 12]

>> y = 0

Hence, the final values of x and y are 12 and 0.

Answer:

  • x = 12
  • y = 0
Similar questions