Skip to main content

Arithmetic Operators

  Python arithmetic operators is used to perform the mathematical operations

Operators

Description

//

Perform Floor division(gives integer value after division)

+

To perform addition

-

To perform subtraction

*

To perform multiplication

/

To perform division

%

To return remainder after division(Modulus)

**

Perform exponent(raise to power)

Example Program:

a=10

b=20

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

print("a-b:",a-b)

print("a*b:",a*b)

print("a/b:",a/b)

print("a%b:",a%b)

print("2**3:",2**3)

print("a//b:",a//b)

Output:

a+b: 30

a-b: -10

a*b: 200

a/b: 0

a%b: 10

2**3: 8

a//b: 0

 

           

 

Comments