/ lang / mod |
|
| Documentation |
|
Remainder = Numerator AS Integer MOD Denominator AS Integer
Calculates the remainder of the quotient of two integer numbers.
![]() |
This operator does not evaluate the true mathematic modulo:
A MOD B = A - (A DIV B) * B |
PRINT 9 MOD 4, -9 MOD 4, 9 MOD -4, -9 MOD -4
1 -1 1 -1
' Example : To test divisibility by 5 DIM N AS Integer N = 563 IF N MOD 5 = 0 THEN PRINT "The number " & N & " is divisible by 5" ELSE PRINT "The number " & N & " is not divisible by 5" ENDIF
The number 563 is not divisible by 5