Monday, July 27, 2020

Write a Program to arithmetical operations in Python.

Arithmetical operations in Python.


number1 = input('Enter first number :: ')  
number2 = input('Enter second number :: ')  
  
# Add two numbers  

add = (number1) + (number2) 

# Subtract two numbers  

min = (number1) - (number2) 

# Multiplication two numbers  

mul = (number1) * (number2)  

#Division two numbers  

div = (number1) / (number2)  

# Display the Addition  

print('The Addition of {0} and {1} is {2}'.format(number1, number2, add))  
  
# Display the subtraction  

print('The subtraction of {0} and {1} is {2}'.format(number1, number2, min))  

# Display the multiplication  

print('The multiplication of {0} and {1} is {2}'.format(number1, number2, mul))  

# Display the division  

print('The division of {0} and {1} is {2}'.format(number1, number2, div))

OUTPUT

Enter first number :: 20
Enter second number :: 3
        The Addition of 20 and 3 is : 23
              The subtraction of 20 and 3 is : 17
                 The multiplication of 20 and 3 is : 60
        The division of 20 and 3 is : 6

No comments:

Post a Comment

Please do not any spam link in Comment Box