Arithmetic Operation in Python

Arithmetic Operation in Python

Symbol Description Example 1 Example 2
+Addition

>>>55+45

100

>>> „Good‟ + „Morning‟

GoodMorning

-Subtraction

>>>55-45

10

>>>30-80

-50

*Multiplication

>>>55*45

2475

>>> „Good‟* 3

GoodGoodGood

/Division

>>>17/5

3

>>>17/5.0

3.4

>>> 17.0/5

3.4

>>>28/3

9

%Remainder/Modulo

>>>17%5

2

>>> 23%2

1

**Exponentiation

>>>2**3

8

>>>16**.5

4.0

>>>2**8

256

//Integer Division

>>>7.0//2

3.0

>>>3/ / 2

1

#Demo Program to test Arithmetic Operators
	a=100
	b=10
	print ("The Sum = ",a+b)
	print ("The Difference = ",a-b)
	print ("The Product = ",a*b)
	print ("The Quotient = ",a/b)
	print ("The Remainder = ",a%30)
	print ("The Exponent = ",a**2)
	print ("The Floor Division =",a//30)
#Program End

Output:

The Sum = 110

The Difference = 90

The Product = 1000

The Quotient = 10.0

The Remainder = 10

The Exponent = 10000

The Floor Division = 3

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz