Q(uick)BASIC Operator: MOD

Quick View

MOD

Divides one number by another and returns the remainder

Worth knowing

Useful and cross-version information about the programming environments of QBasic and QuickBasic.

Syntax
  • numeric-expression1 MOD numeric-expression2
Description/Parameter(s)
umeric-expression1
numeric-expression2
Any numeric expressions. Real numbers are rounded to integers.
Example
PRINT 19 MOD 6.7 'QBasic rounds 6.7 to 7, then divides. 'Output is: 5
Syntax
  • numeric-expression1 MOD numeric-expression2
Description/Parameter(s)

The modulus or "remainder" operator. Divides one number by another (rounding real values to integers, if required) and returns the remainder. For example, 19 MOD 6.7 equals five.

Syntax
  • numeric -expression1 MOD numeric - expression2
Description/Parameter(s)
  • The modulus or "remainder" operator. Divides one number by another (rounding real values to integers, if required) and returns the remainder. For example, 19 MOD 6.7 equals five.