How Does Modulus Divison Work

后端 未结 19 1554
栀梦
栀梦 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

    Maybe the example with an clock could help you understand the modulo.

    A familiar use of modular arithmetic is its use in the 12-hour clock, in which the day is divided into two 12 hour periods.

    Lets say we have currently this time: 15:00
    But you could also say it is 3 pm

    This is exactly what modulo does:

    15 / 12 = 1, remainder 3
    

    You find this example better explained on wikipedia: Wikipedia Modulo Article

提交回复
热议问题