Arithmetic Operations Flashcards
All 6 cards in this deck
What does the arithmetic operator
MODreturn?e.g.
11 MOD 3The remainder after integer division.
11 MOD 3=What does the arithmetic operator
DIVreturn?e.g.
11 DIV 3The whole-number part of a division (remainder discarded).
11 DIV 3=True or false? The
/operator always gives a whole-number answer.False.
/is real division and can give a decimal result, e.g.7 / 2= 3.5.DIVgives the whole-number part, e.g.7 DIV 2= 3.True or false? In
x ← 5 + 2 * 3, the multiplication is done before the addition.True. Normal arithmetic precedence applies, so
xis 11.True or false? In
IF total + 5 > 20 THEN, the comparison>is checked before the addition.False. Arithmetic is done first, so
total + 5is worked out and then compared with 20.How can
MODbe used to test whether a whole number is even?e.g. a number stored in
nn MOD 2 = 0is true whennis even, because an even number leaves no remainder when divided by 2.