Section 6 Calculator

6.1 Arithmetic Operator

Operator Explanation Example
+ Addition 2 + 5
- Subtraction 2 - 5
* Multiplication 2 * 5
/ Division 5 / 2
%% Modulus 5 %% 2
%/% Integer division 5 %/% 2
^ Exponentiation 2 ^ 5
() Parenthesis (precedence rule) (2 + 5)*3

6.2 Examples

12 + 15
12 - 15
12 * 5
15 / 2
15 %% 2
15 %/% 2
2 ^ 5
(12 + 15) / 3
20/4/2
(20/4)/2
20/(4/2)

6.3 More Examples

  • Find the value of the following R expressions:

3^2 + 5 * 8 / 2 - 10

15 %% 2 * 9 / 5 * 2

15 %% 4 / 9 * 3 * 2

2^5 %/% 6 / 2 * 3

2^5 %/% (6 / 2 * 3)

2^5 / 2^3 / 10^2

  • Write an R expression and find the value of the following mathematical expressions:

\[ \large \frac{3^5}{3^2} \times \frac{2^5}{2^3} - \frac{10+4}{7} \]

\[ \large \left(\frac{2^3}{4} + \frac{3^2}{4.5} \right) \left( \frac{10^2}{5+5} - \frac{10^2}{10^{-1}} \right) \]