मराठी

What is the value of x after evaluating: x + = x + + + - - x + 4; if x = 3, before the evaluation?

Advertisements

प्रश्न

What is the value of x after evaluating:

x + = x + + + - - x + 4; if x = 3, 

before the evaluation?

मूल्यांकन
Advertisements

उत्तर

Initial value of x = 3

x + = x + + + - - x + 4;

Step 1: The initial value of x is 3.

Step 2: x++ uses the value 3 and then increments x to 4.

Step 3: --x decreases the value of x from 4 to 3 and uses 3.

Step 4: Evaluate the right-hand side:

3 + 3 + 4 = 10

Step 5: The += operator adds the result to the original value of x.

x = 3 + 10 =13
x = 13
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Variables and Expressions - EXERCISE [पृष्ठ १३२]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
पाठ 6 Variables and Expressions
EXERCISE | Q 33. | पृष्ठ १३२
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×