Addition, subtraction, multiplication and division of two number in python
Write a program to input two values and addition, subtraction, multiplication and division of these numbers.
a = input('Enter first number: ')
b = input('Enter second number: ')
# Addition two numbers
c = int(a) + int(b)
# Display the addition
print('Addition of {0} + {1} = {2}'.format(a, b, c))
# Subtraction two numbers
c = int(a) - int(b)
print('Subtraction of {0} + {1} = {2}'.format(a, b, c))
# multiplication two numbers
c = int(a) * int(b)
print('multiplication of {0} + {1} = {2}'.format(a, b, c))
# Division two numbers
c = int(a) / int(b)
print('Division of {0} + {1} = {2}'.format(a, b, c))
Output:
Comments
Post a Comment