Computer Science, asked by dg6112005678, 2 months ago

if x=8, find the value of y, if y=x-(- -x* x++)+ (++x)*3
use computer increment and decrement operator way

Answers

Answered by BrainlyProgrammer
10

Given:

  • x=8

To solve:

  • y=x-(- -x* x++)+ (++x)*3

Solution:-

 \sf \bold{y=x-(--x * x++) + (++x) *3 } \sf  \\   \sf \: y = 8 - (7 *7) + (9)*3  \\  \sf \: y = 8 - 49 + 27 \\  \sf \: y  =  - 49 + 35 \\  \sf  \green{\boxed{ \purple{ \bold{y = 14}}}}

Always remember:-

  • --x or ++x is called Prefix increment
  • x++ or x-- is called Postfix increment
  • Prefix increment first increase their values then moves forward.
  • Postfix increment first move forward then the value gets increased.
  • Here x is originally 8.
  • --x * x++ So here the value of x first decreases due to --x which is multiplied with x++.
  • x++ will have 7 but soon it reaches ++x(moves forward ) then it becomes 8
  • ++x will first increase the value from 8 to 9 and then moves forward
  • Calculating...
  • you finally gets y=14
Similar questions