wiz-icon
MyQuestionIcon
MyQuestionIcon
3
You visited us 3 times! Enjoying our articles? Unlock Full Access!
Question

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

Open in App
Solution

Program:
#Program to input two numbers and performing all arithmetic operations

#Input first number

num1 = int(input("Enter first number: "))
#Input Second number
num2 = int(input("Enter second number: "))

#Printing the result for all arithmetic operations
print("Results:-")
print("Addition: ",num1+num2)
print("Subtraction: ",num1-num2)
print("Multiplication: ",num1*num2)
print("Division: ",num1/num2)
print("Modulus: ", num1%num2)
print("Floor Division: ",num1//num2)
print("Exponentiation: ",num1 ** num2)


OUTPUT:
Enter first number: 8
Enter second number: 3
Results:-
Addition: 11
Subtraction: 5
Multiplication: 24
Division: 2.6666666666666665
Modulus: 2
Floor Division: 2
Exponentiation: 512

flag
Suggest Corrections
thumbs-up
118
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Arithmetic Progression
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon