Save
...
computer science
programming
arithmetic operators
Save
Share
Learn
Content
Leaderboard
Learn
Created by
lucy dock
Visit profile
Cards (13)
Operation
A
symbol
that performs a
calculation
or
logical test
on its
operands
, it can be
arithmetic
,
comparison
or
boolean
View source
Operand
The
values
that an
operation
applies to, e.g. in age >
18
, both age and
18
are
operands
View source
+
Addition.
This
arithmetic
operator
sums operands
, e.g. x + 4
View source
-
Subtraction
, or
taking away
one operand from another is done by this
arithmetic operation
, e.g. health - 5
View source
*
Multiplication
, the
arithmetic
operation that gives the
product
, or one
operand
times another, e.g. km * 2
View source
/
Real division.
The
arithmetic
operator that
divides
one
operand
by another e.g. total / 7
View source
DIV
Also called
integer division
or
floor division
, the
quotient arithmetic operator
divides operands giving only the
whole number result.
E.g. 9 DIV 4 = 2. Python uses
//
for this.
View source
MOD
The
Modulus operator
which gives the
remainder
after
division
, e.g.
9
MOD 4 =
1. Python
uses
%
for this.
View source
4
9 DIV 2
View source
4.5
9 / 2
View source
1
9 MOD 2
View source
9
2 * 4 + 1
View source
Remainder
The
amount
left over when one number is
divided
by another. Calculated with the
MOD operator
View source