Python Program to Add Two Numbers

« Previous Program Next Program »

Add Two Numbers in Python

To add two numbers in python, you have to ask from user to enter two numbers to find the sum of given two numbers as shown here in the program given below.

Python Programming Code to Add Two Numbers

Following python program ask from user to enter any two number to find and print the sum of those two numbers:

# Python Program - Add Two Numbers
while True:
	print("Enter '0' for exit.")
	print("Enter two numbers: ")
	val1 = int(input())
	val2 = int(input())
	if val1 == 0:
		sum = val1 + val2
		print("Sum of the given two number:",sum,"\n")

Here is the sample run of the above Python program shows how to add two numbers:

python add two numbers

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test