Many programs make use of an operator to carry out mathematical calculations.
For example, a tables testing program needs to multiply two numbers.
The two numbers will be entered into two variables.
These variables could be named number1 and number2.
The * multiplication operator is used to multiply number1 x number2.
Look at the image below to find out how the multiplication operator is used
The 4 common mathematical operators are:
Q15. What are the 4 common mathematical operators?
Study the program script below.
first_number and second_number are the variables in this program?
Q16. What are the the two variables, first_number and second_number, used for in the program?
Q17. Look at the green operator block, will the program add, subtract, multiply or divide the two numbers?
A number of operators can be combined together to perform more complex operations
x and y are variables in a program.
Variable x is multiplied by 5
10 is subtracted from variable y
The two results are then added together.
Q18. If x = 3 and y = 20, what output will the combination of operators shown above produce?