Modulus division when first number is smaller than second number

前端 未结 6 796
时光取名叫无心
时光取名叫无心 2021-01-04 00:20

I apologize if this is a simple question but I\'m having trouble grasping the concept of modulus division when the first number is smaller than the second number. For exampl

6条回答
  •  自闭症患者
    2021-01-04 01:12

    Another nice method to clear things up, In modulus, if the first number is > the second number, subtract the second number from the first until the first number is less than the second.

    17 % 5 = ?
    17 - 5 = 12
    12 % 5 = ?
    12 - 5 = 7
    7 % 5 = ?
    7 - 5 = 2
    2 % 5  = 2
    

    Therefore 17 % 5, 12 % 5, 7 % 5 all give the answer of 2. This is because 2 / 5 = 0 (when working with integers) with 2 as a remainder.

提交回复
热议问题