Help needed | Sololearn: Learn to code for FREE!

+1

Help needed

Int a=4; Int b=8; If((b-a--) >=0) If((b+a)%2==1) System.out.println(a*b); else System.out.println (b+a); Can anyone explain how the answer to this is 24? Thanks.

1/11/2018 11:12:28 AM

Amit Gupta

4 Answers

New Answer

+3

4>0 then 8+3 % 2 == 1 so output is 3*8 = 24

+2

Thanks man

+2

The value of a is changed to 3 in the third line isn't it? Don't we need to do something like a=a-- for that to happen?

0

a-- means a=a-1