Mark Wickens

MOD

Purpose

Returns the remainder of integer division.

Format

( number ) MOD ( divisor )
  └──┬─┘         └──┬──┘ 
  Numeric         Numeric
 expression      expression

Example

X = -15 MOD 7 

Parameters

Explanation

the values are converted to their absolute values before division is performed. The sign assigned to the result of the MOD operation is the sign of the dividend.

Sample Program

10  INPUT "NUMBER"; N
20  INPUT "DIVISOR"; D
30  R=N MOD D
40  PRINT "RESULT="; R
50  END

Shows the remainder of a division between two number.