本文介绍了“mod"和“remainder"有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我朋友说mod"和remainder"是有区别的.

My friend said that there are differences between "mod" and "remainder".

如果是这样,C 和 C++ 中的那些区别是什么?'%' 在 C 中是指mod"还是rem"?

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 43 因为 -21 + 4 x 63.

-21 mod 4 is 3 because -21 + 4 x 6 is 3.

但是 -21 除以 4 得到 -5-1 的余数.

But -21 divided by 4 gives -5 with a remainder of -1.

对于正值,没有区别.

这篇关于“mod"和“remainder"有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:45