Addition Subtraction Division Multiplication #5

Share with others

Python Program Addition Subtraction Division Multiplication

Python Program to perform Addition Subtraction Division Multiplication

In this article, we are going to understand the basic mathematical operations like Addition Subtraction Multiplication Division. So in other words we can say that we are going to discuss the following programs.

  1. Write a program to add two numbers.
  2. Write a program to subtract two numbers.
  3. Write a program to divide two numbers.
  4. Write a program to multiply two numbers.

In all the above programs we will take input from the user.

Let we start with our first program

“Addition of two numbers”

num1 = int(input("Enter First Number: ")) #Accepting first number from the user
num2 = int(input("Enter Second Number: ")) #Accepting Second number from the user
S = num1 + num2 #Adding the two numbers
print("Sum of two numbers are: ", S) #Displaying the result

NOTE: Same way we can add more than two numbers.

OUTPUT

Addition Subtraction Division Multiplication
Addition of two numbers

“Subtraction of two numbers”

num1 = int(input("Enter First Number: ")) #Accepting first number from the user
num2 = int(input("Enter Second Number: ")) #Accepting Second number from the user
S = num1 - num2 #Subtracting the two numbers
print("Difference of two numbers is: ", S) #Displaying the result

OUTPUT

Addition Subtraction Division Multiplication
Difference of two numbers

“Division of two numbers”

num1 = int(input("Enter First Number: ")) #Accepting first number from the user
num2 = int(input("Enter Second Number: ")) #Accepting Second number from the user
S = num1 / num2 #Dividing the two numbers
print("Result of Division of two numbers is: ", S) #Displaying the result

OUTPUT

Addition Subtraction Division Multiplication
Division of two numbers

NOTE: Division of two integers returns a floating point number as shown above.

NOTE: Division by ZERO returns Zero Division Error as shown below

Division by Zero

“Multiplication of two numbers”

num1 = int(input("Enter First Number: ")) #Accepting first number from the user
num2 = int(input("Enter Second Number: ")) #Accepting Second number from the user
S = num1 * num2 #Multiply the two numbers
print("Result of Multiplication of two numbers is: ", S) #Displaying the result

NOTE: Same way we can multiply more than two numbers.

OUTPUT

Multiplication of two numbers

Addition Subtraction Division Multiplication Program




MCQ of Computer Science Chapter Wise

1. Functions in Python

2. Flow of Control (Loop and Conditional statement)

3. 140+ MCQ on Introduction to Python

4. 120 MCQ on String in Python

5. 100+ MCQ on List in Python

6. 50+ MCQ on Tuple in Python

7. 100+ MCQ on Flow of Control in Python

8. 60+ MCQ on Dictionary in Python


Important Links

100 Practice Questions on Python Fundamentals

120+ MySQL Practice Questions

90+ Practice Questions on List

50+ Output based Practice Questions

100 Practice Questions on String

70 Practice Questions on Loops

70 Practice Questions on if-else


Disclaimer : I tried to give you the correct coding of ” Addition Subtraction Division Multiplication Program” , but if you feel that there is/are mistakes in the code or explanation of “Addition Subtraction Division Multiplication Program  “ given above, you can directly contact me at csiplearninghub@gmail.com.


Share with others

Leave a Reply

error: Content is protected !!
%d