Program to add two numbers in Python
In this python program, we will be learning to add two numbers using Python.
To better understand the concept we have an example:
Here, input a and b is taken by the user and then we get the resulting sum as output.
1) Input the numbers from the user.
2) Addition of numbers is stored into a variable “sum”.
3) Print the sum.
a=int(input(“enter the first number:”)) //input first number b=int(input(“enter the second number:”)) //input second number sum=a+b //addition of two numbers print(“sum:”, sum) //the required sum is printed
enter the first number: 2 enter the second number: 4 sum: 6