Python Program to Find Sum of Two Numbers

In this sample program, you will learn to find the sum of two numbers and show it using the print() function.

To understand this demo program, you should have the basic Python programming knowledge:

In the sample below, we’ve made use of the arithmetic addition operator (+) to find the sum of two numbers.

Sample Code: Sum of Two Numbers Entered by The User

# Find sum of two integer numbers
int1 = input('Enter first integer: ')
int2 = input('Enter second integer: ')

# Add two integer numbers
sum = int(int1) + int(int2)

# Show the sum
print('The sum of {0} and {1} is {2}'.format(int1, int2, sum))

The output of the above code is as follows:

Enter first integer: 11
Enter second integer: 22
The sum of 11 and 22 is 33

You can change the (+) operator with the subtraction (-), multiplication (*), division (/), or the floor division (//) operator to perform different operations on the two numbers.

Try executing the above Python program yourself.