Python Program to Perform All Arithmetic Operations on Two Given Numbers
Python program to perform all arithmetic operations on two given numbers.
In this article, you will learn how to write a python program to perform all arithmetic operations on two given numbers.
You should have the knowledge of the following topics in python programming to understand this program.
- Python Arithmetic operators
There we will perform these arithmetic operations like Sum, Difference, Multiplication, Division, and Modulus.
# Python Program to Perform All Arithmetic Operations on Two Given Numbers print("Enter any two positive integer numbers:") p, q = int(input()), int(input()) sum, sub, mul, mod, div = 0, 0, 0, 0, 0 sum = p + q sub = p - q mul = p * q div = p / q mod = p % q print("\n") print("SUM ", p, " + ", q, " = ", sum) print("DIFFERENCE ", p, " - ", q, " = ", sub) print("PRODUCT ", p, " * ", q, " = ", mul) print("QUOTIENT ", p, " / ", q, " = ", div) print("MODULUS ", p, " % ", q, " = ", mod)
In this given program, we have taken inputs
12 from the user then we applied arithmetic operations on these integer numbers.
Then this will be returned the
8 output values of the above program.