def multiply (x, y): if(y < 0 and x > 0): return -multiply(x, -y) if(x < 0 and y > 0): return -multiply(-x, y) if(x < 0 and y < 0): return multiply(-x, -y) if(y == 0 or x == 0): return 0 else: return x + multiply(x, y - 1)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment