English

Given: x + = x++ + ++ x + − − x Find the value, when x = 5. - Computer Applications

Advertisements
Advertisements

Question

Given: x + = x++ + ++ x  + − − x

Find the value, when x = 5.

Options

  • 23

  • 21

  • 22

  • 24

MCQ

Solution

23

Explanation:

The expression is calculated as follows:

x = x + (x++ + ++x + --x)       (x = 5)
x = 5 + (5 + ++x + --x)         (x = 6)  
x = 5 + (5 + 7 + --x)           (x = 7)  
x = 5 + (5 + 7 + 6)             (x = 6)  
x = 5 + 18
x = 23
shaalaa.com
  Is there an error in this question or solution?
Chapter 1.04: Operators in Java - EXERCISES [Page 43]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.04 Operators in Java
EXERCISES | Q I. 5. | Page 43
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×