python adding two numbers {python program to add two numbers without using +}

Example: 1

a = int(input("enter first number: "))
b = int(input("enter the second number: "))
 
sum = a + b
 
print("sum:", sum)

Output
enter first number: 10
enter the second number:10
sum: 20

Example: 2

# adds two numbers

num1 = 2.5
num2 = 5.5

# Add two numbers
sum = num1 + num2

# Display 
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Output

The sum of 2.5 and 5.5 is 8

Example: 3

#  input any numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')

# Add two numbers
sum = float(num1) + float(num2)

# Display the output
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Output

Enter first number: 12
Enter second number: 10
The sum of 12 and 10 is 22

Example: 4

x = input("Type 1st number: ")
y = input("Type 2nd number: ")

sum = int(x) + int(y)

print("Total sum is: ", sum)

Output
Type a number: 22
Type another number:22
The sum is: 44

Example: 5

#Add two numbers

num1=7
num2=10
addition=(num1+num2)
print("1st number :",num1)
print("2nd number :",num2)
print("Addition : ",addition)

First number: 5
Second number: 10
Addition : 25

Keywords:

python program to add two numbers without using + operator,
addition in python,
how to add two variables in python,
how to add numbers in python list,
add two numbers in python using the function,
addition of two numbers in python using user input,
how to add two numbers in a list python,
maximum of two numbers in python,

Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top