A Program to Add Two Numbers

In this example, we are giving a program to add two numbers.


Program to add two numbers:

  1. num1 = 3.5
  2. num2 = 7.3
  3. # Addition of two numbers
  4. sum = num1 + num2
  5. # Display the sum
  6. print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Output:

The sum of 3.5 and 7.3 is 10.8