Write a function to add two positive integers without using the '+' operator


Topic: Write a function to add two positive integers without using the '+' operator

Solution

def add_without_plus_operator(a, b):
    while b != 0:
        data = a & b
        a = a ^ b
        b = data << 1
    return a



List all Python Programs