xHarbour Reference Documentation > Operator Reference |
Modulus operator (binary): calculates the remainder of a division.
<nNumber1> % <nNumber2>
The modulus operator returns the remainder of dividing <nNumber1> by <nNumber2>.
See also: | *, **, +, -, /, = (compound assignment), SET FIXED |
Category: | Mathematical operators , Operators |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example calculates the remainder of a division // between two numbers. PROCEDURE Main ? 5 % 0 // result: 0 ? 3 % 2 // result: 1 ? -2 % 3 // result: -2 ? 4 % 2 // result: 0 ? 5.4 % 2.3 // result: 0.8 RETURN
http://www.xHarbour.com