Search code examples
modulo

Why does 2 mod 4 = 2?


I'm embarrassed to ask such a simple question. My term does not start for two more weeks so I can't ask a professor, and the suspense would kill me.

Why does 2 mod 4 = 2?


Solution

  • Mod just means you take the remainder after performing the division. Since 4 goes into 2 zero times, you end up with a remainder of 2.