Search⌘ K
AI Features

Arithmetic Operations

Explore core arithmetic operations in Bash including addition, subtraction, multiplication, division, exponentiation, and calculating remainders. Understand how to differentiate between division remainder and modulo operations with examples. This lesson helps you apply these concepts to solve programming tasks such as parity checking and time conversion using Bash shell scripting.

We'll cover the following...

Arithmetic operations

Let’s start with the arithmetic operations since they are relatively simplest. Programming languages use regular symbols to denote them:

  • + addition
  • - subtraction
  • / division
  • * multiplication

There are two more operations that are often used in programming. These are exponentiation and division with remainder.

Let’s suppose that we want to raise the number a to the power of b. We can write it as a​b​​. Here, a is ...