Arithmetic operations are fundamental to programming and mathematics. This guide will cover the basics of arithmetic operations, including addition, subtraction, multiplication, division, and modulus.

Basic Arithmetic

Addition

Addition is the process of combining two or more numbers to get a sum. The plus sign (+) is used to denote addition.

result = 5 + 3
print(result)  # Output: 8

Subtraction

Subtraction is the process of finding the difference between two numbers. The minus sign (-) is used to denote subtraction.

result = 10 - 4
print(result)  # Output: 6

Multiplication

Multiplication is the process of repeating a number a certain number of times. The asterisk (*) is used to denote multiplication.

result = 6 * 7
print(result)  # Output: 42

Division

Division is the process of dividing one number by another. The forward slash (/) is used to denote division.

result = 20 / 4
print(result)  # Output: 5.0

Modulus

The modulus operator % returns the remainder of the division of two numbers.

result = 20 % 3
print(result)  # Output: 2

Order of Operations

When performing multiple arithmetic operations, it's important to follow the order of operations, often remembered by the acronym PEMDAS (Parentheses, Exponents, Multiplication and Division (from left to right), Addition and Subtraction (from left to right)).

result = (10 + 5) * 2 - 3
print(result)  # Output: 27

Practice

To practice what you've learned, try solving the following exercises:

  1. Calculate the sum of 7 and 8.
  2. Subtract 10 from 25.
  3. Multiply 6 by 4.
  4. Divide 24 by 3.
  5. Find the remainder when 17 is divided by 4.

For more practice and exercises, visit our Arithmetic Operations Exercises.

Mathematics Equation