- 2
Why is output 30? Not 20
9 Antworten
+ 6
Because (10 == 20) is false so (a == b) will give 0
so b = a + b + 0 = 10 + 20 + 0 = 30
+ 4
After putting the values of *a* and *b* which is initially 10 and 20 respectively
The statement :-
b=a+b-(a==b)
Becomes
b = 10 + 20 - (10==20)
As 10==20 is false so will return 0
b = 10 + 20 - 0
b = 30
but the question is why do you think the answer should be 20 ?
+ 3
How 10 == 20 is 10? Do you know double equal is used for comparing values?
+ 2
Ok No problem it happens when you learn something new.
Хорошо, нет проблем, это случается, когда узнаешь что-то новое.
+ 1
I got it. I think 10==20 is 10 and b = 10 + 20 - 10
+ 1
I Am AJ, thank you. I confused with assignment("=")
+ 1
Thank you, good luck!
0
Maybe you add a as 10, b as 20, and the problem is a + b which pops up 30.