Python Program to add two integers

Problem

Write a program in Python to add two integers and display the result on the screen.

Python Program to add two integers

# Abundantcode.com program to add two integers and display result
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')

result = float(num1) + float(num2)

# Display the sum
print('{0} + {1} = {2}'.format(num1, num2, result))

Output

Enter first number: 1                                                                                                                                                        
Enter second number: 2                                                                                                                                                                  
1 + 2 = 3.0

Leave Your Comment

Liked this content?. Please spread the word :)