11 lines
237 B
Python
11 lines
237 B
Python
|
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)
|
||
|
|
||
|
print(multiply(3, 5));
|