Programming constructs - CCEABoolean and arithmetic operators

Computer programs use data stores to organise the different types of data they contain. Data stores can be either a constant, variable or an array, and contain inputs, outputs, functions, instructions, sequences and more.

Part ofDigital Technology (CCEA)Digital development concepts (programming)

Boolean and arithmetic operators

Programming languages can perform maths on the numbers they store in , constants and .

Mathematical operations use as input and carry out a mathematical function based on the .

Operators represent computations like addition, multiplication and division. The values the operator works on are called operands.

A simple sum demonstrating operators and operands

Common mathematical operators used in programming include:

OperatorName and descriptionExample
+Addition2 + 2 = 4
Subtraction4 – 2 = 2
/Division8 / 4 = 2
*Multiplication4 * 8 = 32
^Exponentiation: When one number increases exponentially (the number of times) to another. The repeated multiplication of a number by itself.2 ^ 4 = 16 (2 * 2 * 2 * 2 = 16, or 24)
MODModulus: The remainder that is left over when a number is divided by another. Some programming languages will use the % symbol for MOD.16 MOD 3 = 1 (16 / 3 = 5, with 1 left over)
DIVInteger division: Used to find the quotient (integer number before the decimal point) after division. Python uses // for this.100 DIV 3 = 33 (actual value 33.333333333 repeating)
Operator+
Name and descriptionAddition
Example2 + 2 = 4
Operator
Name and descriptionSubtraction
Example4 – 2 = 2
Operator/
Name and descriptionDivision
Example8 / 4 = 2
Operator*
Name and descriptionMultiplication
Example4 * 8 = 32
Operator^
Name and descriptionExponentiation: When one number increases exponentially (the number of times) to another. The repeated multiplication of a number by itself.
Example2 ^ 4 = 16 (2 * 2 * 2 * 2 = 16, or 24)
OperatorMOD
Name and descriptionModulus: The remainder that is left over when a number is divided by another. Some programming languages will use the % symbol for MOD.
Example16 MOD 3 = 1 (16 / 3 = 5, with 1 left over)
OperatorDIV
Name and descriptionInteger division: Used to find the quotient (integer number before the decimal point) after division. Python uses // for this.
Example100 DIV 3 = 33 (actual value 33.333333333 repeating)