Basic Operators

Arithmetic Operators

Simple arithmetics on variables can be done using the arithmetic expression: $((expression))

B=$((100 * $A + 5)) # 305

The basic operators are:

a + b addition (a plus b)

a - b substraction (a minus b)

a * b multiplication (a times b)

a / b division (integer) (a divided by b)

a % b modulo (the integer remainder of a divided by b)

a ** b exponentiation (a to the power of b)


In this exercise, you will need to calculate to total cost (variable TOTAL) of a fruit basket, which contains 1 pineapple, 2 bananas and 3 watermelons. Don't forget to include the cost of the basket....

Copyright © Read our Terms of Use and Privacy Policy