# How to use the MOD operator in TRS-80 model 100 BASIC?

I'm finding the MOD operand is not working when I enter it in the BASIC prompt. This is how I write it out.

``````PRINT 1 * MOD(23)

?SN Error
``````

I have looked into a reference guide and it is too broad on the MOD operand. On page 10 in the link.

TRS-80 Model 100 Reference

`MOD` is an operator, not a function.

Try `? 10 mod 9` and see yourself.

Several BASIC dialects have `DIV` and `MOD` operators, which return the quotient and remainder respectively from integer division. This is nearly equivalent to using `/` and `%` operators on integers in C. They are infix operators, even though their syntax is a keyword rather than a symbol.

Conversely, the `/` operator in most BASICs performs floating-point division and has no remainder counterpart.

``````A = 124
D = 34
Q = A DIV D
R = A MOD D
F = A / D
PRINT Q,R,F
``````

yields

``````3    22    3.6471
``````

For anyone unfamiliar with mathematics the answer is simple. After trying brute force I found that the format is sometimes confusingly different than pencil and paper.

Here it is.

``````print 124 MOD 34
22
``````
• Just out of curiosity, what did you think the meaning of a one-operand MOD function would be?
– dave
Commented Apr 3, 2019 at 0:58
• And why multiply it by one? Commented Apr 3, 2019 at 13:15
• Mathematicians use "mod" more has a notation indicating they're working with the integers modulo N rather than an operator. They'll write "5 = 12 mod 7" hence Travis' first guess. en.wikipedia.org/wiki/Modular_arithmetic covers this in more detail Commented Sep 13, 2019 at 19:14