teach-ict.com logo

THE education site for computer science and ICT

3. Arithmetic operators

You are already familiar with many simple arithmetic operations: addition, subtraction, division and multiplication. The symbols used to represent these operations in a program are mostly the same ones you see in a maths textbook:-

+ for addition

- for subtraction

* for multiplication

/ for division

Arithmetic operators have two arguments, one on either side. Their position matters most for things like subtraction and division. 100/2 is very different from 2/100.

 

You can use multiple arithmetic operators on the same line, if you need to perform a complex calculation. The order that you carry out these calculations, called the 'order of operations' is BODMAS. This stands for

  • Brackets first
  • Order (numbers involving powers or square roots)
  • Division
  • Multiplication
  • Addition
  • Subtraction

This lets you work out expressions such as

x ??? 1 + ( 3 - 1) - 23 + 10/3

in the same order that everyone else will use.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: What are arithmetic operators?