Device Monitoring Studio - Monitor, log and analyze data coming through PC ports and connections
Download Device Monitoring Studio Hide this button

% Modulo Division Operator

This operator computes the remainder of the division of the first operand by the second operand.


exp1 % exp2

If the divisor evaluates to zero, a run-time error occurs.

4 % 2     // evaluates to 0
5 % 2     // evaluates to 1
5 % 0     // a run-time error occurs

This operator is not applicable to floating-point values.