How Does Modulus Divison Work

后端 未结 19 1898
栀梦
栀梦 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:17

    Easier when your number after the decimal (0.xxx) is short. Then all you need to do is multiply that number with the number after the division.

    Ex: 32 % 12 = 8

    You do 32/12=2.666666667 Then you throw the 2 away, and focus on the 0.666666667 0.666666667*12=8 <-- That's your answer.

    (again, only easy when the number after the decimal is short)

提交回复
热议问题