How is 24 the output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How is 24 the output?

Java challenge https://code.sololearn.com/cy1KLk1xI6w4/?ref=app

19th Jun 2021, 5:51 AM
alagammai uma
alagammai uma - avatar
2 Answers
+ 1
Because here first if condition is satisfied that's why it printing result of a *b int a=4; int b=8; if((b-a--)>=a) { System.out.println(a*b); } Here condition will check like this if(8-4-- >=a) here u used post decrement thats why expression will be calculate after that a-- here value will be decrease by 1 if(8-4>=3) and bow the current value of a is 3 so output will be 3*8 which is 24
19th Jun 2021, 6:08 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
A.S. thank you
19th Jun 2021, 6:15 AM
alagammai uma
alagammai uma - avatar