Seneca

Arithmetic Operators

Computer Science: KS3, topic 2.1.4

Arithmetic Operators

Operators are symbols that represent a specific function within a program.

Basic operators

Basic operators

  • Addition is done using a + sign.
  • Subtraction is done using a - sign.
  • Division is done using a / sign.
  • Multiplication is done using a * sign.
  • Exponentiation is done using a ^ or ** sign.
Modulo operator

Modulo operator

  • The modulo operator gives the remainder of the division of two numbers.
  • For example:
  • 5 MOD (or %) 2 would be equal to 1.
Integer division

Integer division

  • The integer division operator returns the quotient (whole part) of a division.
  • For example:
  • 5 DIV (or //) 2 would give 2.

Test yourself on Arithmetic Operators

  • What is the result of 17 MOD 5?

  • Choose the correct statement in each pair.

  • What operation does DIV perform?

Practise this topic for free