My friend said that there are differences between "mod" and "remainder".
If so, what are those differences in C and C++? Does '%' mean either "mod" or "rem" in C?
There is a difference between modulus and remainder. For example:
-21 mod 4 is 3 because -21 + 4 x 6 is 3.
-21
4
3
-21 + 4 x 6
But -21 divided by 4 gives -5 with a remainder of -1.
-5
-1
For positive values, there is no difference.
1.4m articles
1.4m replys
5 comments
57.0k users