Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

What's the difference between "mod" and "remainder"?

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?

Answer*

Draft saved
Draft discarded
Cancel
2
  • 2
    Did you mean that sign of the remainder is always the same sign as the dividend? The quotient of 7 / -3 = -2, but 7 rem -3 = 1. Commented Nov 9, 2020 at 16:52
  • "remainder the same sign as the quotient" --> No, not in C. 7/-3 has the quotient -2 and the 7%-3 has the remainder of 1. Commented Dec 12, 2022 at 8:43

lang-c

AltStyle によって変換されたページ (->オリジナル) /