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

Why the answer is 10?

X=10 Y=5 x= --y+x-- - --x+y; Sout(x) ;

30th Apr 2021, 6:22 AM
kreddyt
kreddyt - avatar
3 Answers
+ 4
Karthik Reddy Thotamgari Here --y and --x are pre-decrement which first decrement by 1 then assign value x-- is post decrement which first assign value then decrement by 1 in x So finally x = 10 y = 5 --y = 4 y = 4 x-- = 10 x = 9 but there is --x so --x = 8 x = 4 + 10 - 8 + 4 = 10
30th Apr 2021, 6:45 AM
A͢J
A͢J - avatar
30th Apr 2021, 6:42 AM
kreddyt
kreddyt - avatar
0
Karthik Reddy Thotamgari How should be answer 10 when there is no value of x and y?
30th Apr 2021, 6:38 AM
A͢J
A͢J - avatar