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%53 として計算されますが、他のハードウェアでは 2 として評価されます。これに対応するために、標準%では負の値についてあいまいなままになっています。
n%5
%