0

Was is the reason for this strange behavior?

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

9th Mar 2019, 7:21 AM
Kiuziu 💘 Berlin
Kiuziu 💘 Berlin - avatar
2 Antworten
+ 2
Use parenthesis: #define prod(i, j) (i) * (j) Otherwise, you'll get this as output: prod(x-1, y) == x-1*y == 11-5 == 6. prod(x+1, y) == x+1*y == 11+5 == 16. prod(x, y-1) == x*y-1 == 55-1 == 54. prod(x, y+1) == x*y+1 == 55+1 == 56. prod(x-1, y-1) == x-1*y-1 == 11-5-1 == 5. prod(x+1, y+1) == x+1*y+1 == 11+5+1 == 17.
9th Mar 2019, 7:40 AM
Diego
Diego - avatar
+ 2
Thanks for the answers. Now i understand the rules.
18th Mar 2019, 1:48 PM
Kiuziu 💘 Berlin
Kiuziu 💘 Berlin - avatar