How does modulus of a smaller dividend and larger divisor work?

后端 未结 10 1264
误落风尘
误落风尘 2020-12-15 04:47
7 % 3 = 1 (remainder 1)

how does
3 % 7 (remainder ?)

work?

10条回答
  •  一整个雨季
    2020-12-15 05:00

    As long as they're both positive, the remainder will be equal to the dividend. If one or both is negative, then you get reminded that % is really the remainder operator, not the modulus operator. A modulus will always be positive, but a remainder can be negative.

提交回复
热议问题