Arithmetic operations, or calculations, are important parts of programming. Almost every program includes at least a few arithmetic operations. ActionScript3 has the following operators:

Operator | Purpose | Example | num |
---|---|---|---|

+ | addition | num=4+5; | 9 |

- | minus | num=5-2; | 3 |

* | multiplication | num=3*4; | 12 |

/ | division | num=12/5; | 2.4 |

% | remainder (modulus) | num=17%5; | 3 |

The % may be new to you. Consider the example below. Before children learn about decimal numbers they may solve the division of 17 by 5 as "3 with a remainder of 2"

Test yourself with the movie below. Think of the answer, and then move the cursor over the check box to see the answer. Click the arrow button for the next problem.