Write a Python program to enter two numbers and perform all arithmetic operations.

PROGRAM

# Program to perform all arithmetic operations using separate variables
# Input
a = float(input(“Enter first number: “))
b = float(input(“Enter second number: “))
# Arithmetic operations using different variables
add = a + b
sub = a – b
mul = a * b
div = a / b
floor_div = a // b
mod = a % b
exp = a ** b
# Output
print(“Addition:”, add)
print(“Subtraction:”, sub)
print(“Multiplication:”, mul)
print(“Division:”, div)
print(“Floor Division:”, floor_div)
print(“Modulus:”, mod)
print(“Exponentiation:”, exp)

OUTPUT

TRY THE ABOVE CODE

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.