Python Program to Add Two Numbers

83
views
add two numbers

Simple Program to add Two Numbers and Display on the output screen

To properly understand this example i.e Addition two Number, you should have the knowledge of following Python programming topics:

  1. Input, Output, and Import
  2. Variables and Data Types
  3. Operators

In the following program, we have used the arithmetic addition operator i.e (+) to adds two number.

Program to Add Two Number

num1 = 1.5
num2 = 6.3

# Add two numbers
sum = float(num1) + float(num2)

# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Output

The sum of 1.5 and 6.3 is 7.8
Python Program to Add Two Numbers

As mentioned above Python uses all the mathematic operation so by Changing (+) operator, we can subtract (-), multiply (*), divide (/), floor divide (//) or find the remainder (%) of two numbers.

Related Program

  1. Python Program for Addition of Two Numbers Given by User
  2. Python Program to find the area of Triangle in Python
  3. Program to Solve Quadratic Equation in Python
  4. Program to Generate a Random Number

Ask your questions and clarify your/others doubts on Addition of two Number in Python by commenting. Python Documentation