Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
具有以下功能:
int five(int n) { if ((n%5)==0) return 1; else return 0; }
为什么即使没有余数也只有这个正数的限制?
对于 n == -2,某些硬件将计算n%5为 3,而其他硬件将其评估为 2。为了适应这种情况,标准%对负值留下了模棱两可的含义。
n%5
%