Write a program to add two numbers with user input
Output
in above program the sum is 10 10 , input function is take a string value of variable x and y
so we convert the input value in string to int
Program
# create variable that Store input values
x = input('enter first number: ')
y = input('enter second number: ')
sum = x + y ;
# show the output
print(“sum of num1 and num2 is ",sum)
enter first number: 10
enter second number: 10
sum of num1 and num2 is 1010
Example
Output
# convert the input that Store integer values in variable x and y
x = int(input('enter first number: '))
y = int(input('enter second number: '))
sum = x + y ;
# show the output
print(“sum of num1 and num2 is ",sum)
enter first number: 10
enter second number: 10
sum of num1 and num2 is 20