How to Run Basic Meth of Two Numbers in Python

This example will teach us how to read two digits and calculate their sum, difference, product, quotient, and quotient integer parts and remainder in Python.

Source Code

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

i = int(input("Enter the first number: "))
j = int(input("Enter the second number: "))
addition = i + j                    
subtraction = i - j                 
multiplication = i * j              
division = i / j                    
floorDivision = i // j              
remainder = i % j                   
print("The addition operation result is: ", addition)
print("The subtraction operation result is: ", subtraction)
print("The multiplication operation result is: ", multiplication)
print("The division operation result is: ", division)
print("The integral part of the quotient is: ", floorDivision)
print("The remainder of the quotient is: ", remainder)


Enter the first number: 19
Enter the second number: 6
The addition operation result is:  25
The subtraction operation result is:  13
The multiplication operation result is:  114
The division operation result is:  3.1666666666666665
The integral part of the quotient is:  3
The remainder of the quotient is:  1
Notify of
Inline Feedbacks
View all comments