Arithmetic operators

Learn about the 2nd category of operators. See how arithmetic operators are used to perform mathematical calculations in programming.

Before learning about arithmetic operators, it is first recommended that you already know the assignment operator.

If you still don’t know what the assignment operator is, you should certainly read this article in which we explain in detail about it.

But let’s get down to business!

What are arithmetic operators?

Arithmetic operators represent the 2nd category of programming operators. We use them to perform mathematical operations.

The main programming languages use arithmetic operators in order to perform the basic operations of mathematics:


which represents sum.

which represents subtraction.


which represents multiplication.


which represents division.


which represents the rest of the division.

However, we can observe that the symbols of the multiplication and division operators used in programming are different from those used in mathematics.

In computer programming

In mathematics

It is likely that you have also noticed that the operator of the rest of the division, represented by the symbol %, has no representation in mathematics!

In addition, some programming languages (such as Javascript and Python) also have the exponentiation operator, represented by the symbol **. It is used for the purpose of performing operations with powers.

How to use arithmetic operators?

Just to give an example, below is a small algorithm that demonstrates how to use arithmetic operators to perform operations with variables. varA = 5; varB = varA + 3; varC = varA * varB;

Line 1 shows the declaration of the variable “varA” and the placement of the value 5 inside it. varA = 5;

Line 2 is the first use of the addition arithmetic operator. The content of the variable “varA” (the value 5) is added to the value 3. This results in the value 8, which is, finally, placed inside the variable “varB”. The animation below illustrates how this happens: varB = varA + 3;

Then, in line 3, the multiplication operator is used. The value of the variable “varA” (the value 5) is multiplied by the value of the variable “varB” (the value 8). This results in the value 40, which is finally placed inside the variable “varC”. The animation below illustrates how this happens: varC = varA * varB;


Now that you understand how arithmetic operators work in programming, answer a few questions to test your learning.


Check out the practices we have prepared below to help you deepen your knowledge on this subject!

Choose your programming language and dig deeper.

Practice 01

Practice 02

Certainly, these examples were quite enlightening for you. Eventually, some specific doubts may arise about the use of these operators in certain situations.

So, keep learning! Read our article on conditional statements and continue your studies.

Likewise, it is important to remember that arithmetic operators represent the 2nd of the 5 categories of programming operators. See our articles about the other operators:

Was this article helpful to you?

So support us and share it with others who are interested in this subject!


Other articles


This website uses cookies to ensure you get the best experience on our website.