Write a Python program to multiply two integers without using the '*' operator in python.


Topic: Write a Python program to multiply two integers without using the '*' operator in python.

Solution

def multiply(x, y):
    if y < 0:
        return -multiply(x, -y)
    elif y == 0:
        return 0
    elif y == 1:
        return x
    else:
        return x + multiply(x, y - 1)



List all Python Programs