Remainder Being negative or positive?

118 Views Asked by At

I'm trying to determine if I would have a negative or positive remainder. I'm writing a program that would divide $-326$ by $7$. The program gives me $-46$ with a remainder of $-4$, however when I checked some other results online I got that my remainder would be $3$. I'm just unsure which would be the proper remainder in this case.

Thanks

1

There are 1 best solutions below

4
On

The remainder is $3$. The reainder of the division of an integer $a$ by a natural number $b$ is always an element of $\{0,1,\ldots,b-1\}$.