Skip to main content

Posts

Showing posts with the label floor division

Arithmetic Operators in python

>> Arithmetic operators + (Addition) - (Subtraction) * (Multiplication) / (Division) // (Floor Division) % (Modulus) ** (Exponent). >> Other operators are Comparison, Assignment and Logical which are most widely used. 1) Adding two variables:  a = 12 b = 231 add = a + b print('The addition is:', add) #Output: The addition is: 243 2) Subtracting two variables: a = 12 b = 231 subtract = b - a print('The subtraction is:', subtract) #Output: The subtraction is: 219 3) Multipling two variables: a = 12 b = 231 multiplication = a * b print('The multiplication is:', multiplication) #Output: The multiplication is: 2772 4) Dividing two variables: a = 12 b = 231 division = b/a print('The division is:', division) #Output: The division is: 19.25 5) Floor division: a = 12 b = 231 floor_division = b//a print('The floor division is:', floor_division) #Output: The floor division is: 19 6) Modulus: a = 12 b = 231 modulus = b % a print('The modulus