codemaniacstudio

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

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

Exit mobile version