Please explain why 17 @ = 17

前端 未结 6 2016
[愿得一人]
[愿得一人] 2021-01-28 06:22

I am new to Java, actually programming in general. I understand that the modulus operator (%) returns the remainder of two numbers, however, I do not understand why 17 % 40 = 1

6条回答
  •  感情败类
    2021-01-28 06:52

    When you divide 17/40, quotient is 0 and the remainder is 17.

    The modulo operator (%) returns the remainder.

    i.e

    a % b = remainder of a / b
    

提交回复
热议问题