Q. Write a program to enter two integers and perform all arithmetic operations on them.


Answer: -


num1 = float(input("Enter First number: "))
num2 = float(input("Enter Second number: "))

print("Addition: -",num1 + num2)
print("Subtraction: -",num1 - num2)
print("Multiplication: -",num1 * num2)
print("Division: ",num1 / num2)
print("Floor Division: -",num1 // num2)
print("Modulus: -", num1 % num2)
print("Exponentiation: -",num1 ** num2)


Output:-

Enter First number: 5
Enter Second number: 7
Addition: - 12.0
Subtraction: - -2.0
Multiplication: - 35.0
Division:  0.7142857142857143
Floor Division: - 0.0
Modulus: - 5.0
Exponentiation: - 78125.0

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post