Write a program in python to store two numbers in variables and display the result.
Answers
Answered by
4
Answer:
- num1 = input('Enter first number: ')
- num2 = input('Enter second number: ')
- # Add two numbers.
- sum = float(num1) + float(num2)
- # Display the sum.
- print('The sum of {0} and {1} is {2}'. format(num1, num2, sum))
Answered by
1
Answer:
a = int(input("Enter 1st number : "))
b = int(input("Enter 2nd number : "))
print(f'1st number is : {a}\n2nd number is : {b}')
Explanation:
input() : takes the user value as string
int() : then we use int to typecast the user value to integer
Similar questions