How Does Modulus Divison Work

后端 未结 19 1911
栀梦
栀梦 2020-11-22 06:55

I don\'t really understand how modulus division works. I was calculating 27 % 16 and wound up with 11 and I don\'t understand why.

I can\'t

19条回答
  •  一个人的身影
    2020-11-22 07:08

    27 % 16 = 11

    You can interpret it this way:

    16 goes 1 time into 27 before passing it.

    16 * 2 = 32.

    So you could say that 16 goes one time in 27 with a remainder of 11.

    In fact,

    16 + 11 = 27

    An other exemple:

    20 % 3 = 2

    Well 3 goes 6 times into 20 before passing it.

    3 * 6 = 18

    To add-up to 20 we need 2 so the remainder of the modulus expression is 2.

提交回复
热议问题