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

SOLUTION....

# Program to perform all arithmetic operations on two numbers

# Input
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))

# Arithmetic operations stored in different variables
addition = a + b
subtraction = a - b
multiplication = a * b
division = a / b
floor_division = a // b
modulus = a % b
exponent = a ** b

# Output
print("Results of Arithmetic Operations:")
print("Addition = ",addition)
print("Subtraction = ",subtraction)
print("Multiplication = ",multiplication)
print("Division = ",division)
print("Floor Division = ",floor_division)
print("Modulus = ",modulus)
print("Exponent =", exponent)

OUTPUT

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.