Increment and Decrement Operators in Java | MCA | BTECH | BCA | BSC | ICSE CLASS 9 AND 10

Опубликовано: 03 Июнь 2020
на канале: E- Gurukul
227,972
9.2k

How to solve expressions having Increment ++ and Decrement -- operators in both prefix and postfix mode in Java

For more examples consider
   • Increment and Decrement Operators in ...  

Telegram group link(for notes and notifications): https://t.me/icsecomputerapp


Answers of the questions given:

1. 32

2. a=(++b) * b++ - --x, b=3 and x=5

ans: 12

a=4 *4 - 4
a=16-4=12

3. (i) 0
(ii) 30

More Questions to practice:

1. if x = 5 find
i) ++x*2. ans: 12
ii) x++*2. ans: 10


2. if y=8 and x=13 then find c
c=++y+x+ y--

Ans:. 31

3. if x=3 find x
x+=x++ + --x + 6

Ans:. 15

4. if y = 11 find
i) 10*++y-1. ans: 119

ii) ++y+y++. ans:. 24


5. if a=25, find the value of
a-=++a%10*a--

a = a - ++a % 10 * a--
a = a - 26%10 * a--
a = a - 6*26--
a = 25-156
a = -131

ans: -131