# Python Arithmetic Operators Example

Here, we are going to learn about the arithmetic operators in Python and writing a Python program to demonstrate the example for arithmetic operators.
Submitted by Shivang Yadav, on March 22, 2021

## Python Arithmetic Operators

Following are the Arithmetic Operators (also known as Mathematical Operators) in Python which are used to perform the arithmetic operations,

Operator Name Description Example
a=10,b=20
- Subtraction Returns the subtraction of two numbers a-b = -10
* Multiplication Returns the product (multiplication) of two numbers a*b = 30
/ Division Returns the result of the divide operation of two numbers a = 10,b=3
a/b=3.333
% Modulus Returns the remainder of the two numbers a=10,b=3
a%b=1
** Exponent Returns the result of exponential operation of two numbers a=2, b= 3
a**b = 8
// Floor division Returns the result of the floor division i.e., returns the result without decimal points for positive numbers and returns the floored value if any of the operands is negative a=10,b=3
a//b=3
a=10,b=-3
a//b=-4

## Python program to demonstrate the example for arithmetic operators

```# Python program to demonstrate the
# example of arithmetic operators

a = 10
b = 3

result = a+b
print("a+b :", result)

# subtraction
result = a-b
print("a-b :", result)

# division
result = a/b
print("a/b :", result)

# modulus
result = a%b
print("a%b :", result)

# exponent
result = a**b
print("a**b :", result)

# floor division
result = a//b
print("a//b :", result)

# updating the values of a & b
a = -10
b = 3
print("a:", a, "b:", b)
result = a//b
print("a//b :", result)
```

Output:

```a+b : 13
a-b : 7
a/b : 3.3333333333333335
a%b : 1
a**b : 1000
a//b : 3
a: -10 b: 3
a//b : -4
```

Preparation