Airthmetic Operator my code

'''
Created on Apr 21, 2021
Operators are= 
Arithmetic operators
Assignment operators
Assignment_2 operators
Logical operators
Identity operators
Membership operators
Bitwise operators
@author: hp
'''

'''Arithmetic operators
+    Addition          =x + y    
-    Subtraction       =x - y    
*    Multiplication    =x * y    
/    Division          =x / y    
%    Modulus           =x % y    
**    Exponentiation   =x ** y    
//    Floor division   =x // y

 '''
print(" +  Addition")
x=9
c=10
a=x+c

print (x, "or" , c)
print("Result is :",a)
print(" - subtraction")
x=9
c=10
a=x-c
print (x, "or" , c)
print("Result is :",a)


print("* Multiplication")

x=9
c=10
a=x*c
print (x, "or" , c)
print("Result is :",a)
print("/    Division")

x=9
c=10
a=x/c
print (x, "or" , c)
print("Result is :",a)
print("%    Modulus")

x=14
c=4
a=x%c
print (x, "or" , c)
print("Result is :",a)

print("** Exponentiation")
x = 2
y = 5
print (x, "or" , y)
print("Result is :",x ** y) #same as 2*2*2*2*2

print("the floor division")
x = 20
y = 2
print (x, "or" , y)
print("Result is :",x // y)

#the floor division // rounds the result down to the nearest whole number

Comments