Assignment Question: Given two numbers num1 and num2. The task is to write a Python program to find the addition of these two numbers.
Examples:
Input :
num1 = 5,
num2 = 3
Output: 8
Input
num1 = 13,
num2 = 6
Output: 19
Solution 1:
# Python3 program to add two numbers
num1 = 15
num2 = 12
# Adding two nos
sum = num1 + num2
# printing values
print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))
Output:
Sum of 15 and 12 is 27
Solution 2: Adding two number provided by user input
# Python3 program to add two numbers
number1 = input("First number: ")
number2 = input("\nSecond number: ")
# Adding two numbers
# User might also enter int numbers
sum = int(number1) + int(number2)
# Display the sum
# will print value in int
print("The sum of {0} and {1} is {2}" .format(number1, number2, sum))
Output:
First number: 13 Second number: 5
The sum of 13 and 5 is 18