REM function

Syntax

REM (dividend, divisor)

Description

Use the REM function to calculate the remainder after integer division is performed on the dividend expression by the divisor expression.

The REM function calculates the remainder using the following formula:

REM (X, Y) = X - (INT (X / Y) * Y)

dividend and divisor can evaluate to any numeric value, except that divisor cannot be 0. If divisor is 0, a division by 0 warning message is printed, and 0 is returned. If either dividend or divisor evaluates to the null value, null is returned.

The REM function works like the MOD function.

Example

X=85; Y=3
PRINT 'REM (X,Y)= ',REM (X,Y)

This is the program output:

REM (X,Y)=     1