C either rounds towards 0 on integer division or maybe does something implementation specific if the denominator is negative?

anyway

the "correct" definition of integer / and % is:

a / b = x, a % b = r, where

a = bx + r

0 <= r < |b|

(remainder is always positive, which requires rounding towards negative infinity)

*math is made up and you can define division however you want, unless you want algebra to work, then there's some rules you gotta follow