Arithmetic Operators
There are seven types of Arithmetic Operators.Arithmetic Operator Sign Description
- Addition + left and right add operand.
- Subtraction - subtracts left operand from the right operand.
- Multiplication * multiply the left and right operand.
- Divides right operand from division / left operand.
- Modulus returns the remainder by dividing the right operand from the% left operand.
- Floor division returns floor value by dividing right operand from // left operand.
- The power of the exponent ** left operand is the right operand.
Addition Arithmetic Operator in Python
Source Code:Addition |
ADD THE TWO NUMBERS
Enter first number:17
Enter second number:21
sum of 17 and 21 is 38
Subtraction Arithmetic Operator in Python
Source Code:Subtraction |
Output:SUB THE TWO NUMBERS
Enter first number:21
Enter second number:17
sub of 21 and 17 is 4
Multiplication Arithmetic Operator in Python
Source Code:Multiplication |
Output:
MULTIPLY THE TWO NUMBERS
Enter first number:17
Enter second number:21
Mul of 17 and 21 is 357
Division Arithmetic Operator in Python
Source Code:Division |
Output:DIV THE TWO NUMBERS
Enter first number:21
Enter second number:17
Div of 21 and 17 is 1.2352941176470589
ZeroDivisionError: division by zero
Modulus Arithmetic Operator in Python
Source Code:Module |
Output:
MODULE THE TWO NUMBERS
Enter first number:21
Enter second number:17
Mod of 21 and 17 is 4
Floor Division Arithmetic Operator in Python
Source Code:floor divsion |
Output:
FLOOR DIVISION THE TWO NUMBERS
Enter first number:17
Enter second number:21
Exp of 17 and 21 is 0
Exponent Arithmetic Operator in Python
Source Code:Exponent |
Output:EXPONENT THE TWO NUMBERS
Enter first number:5
Enter second number:3
Exp of 5 and 3 is 125
Click here to see the previous post
0 Comments