+ 1

Guess the output and explain why?

https://code.sololearn.com/ccdWBc62ikiE/?ref=app

11th Sep 2019, 5:42 AM
Sudhanshu
Sudhanshu - avatar
2 Answers
+ 3
It is because operators precedence. If you try to calculate 3 - 2 * 4, the multiplication is evaluated first and then the subtraction, thus -2 * 4 = -8 and 3 - 8 = -5. If you want to change the order of operations you must use parentheses: (3 - 2) * 4 = 1 * 4 = 4.
11th Sep 2019, 7:23 AM
devanille
devanille - avatar
+ 2
Write the macro as (i)*(j)
11th Sep 2019, 6:11 PM
Vaibhav Tandon
Vaibhav Tandon - avatar