From 0934ecb21fd34a6cdb697c52b38cb6986162366c Mon Sep 17 00:00:00 2001 From: Derderderr Date: Sat, 14 Feb 2026 12:45:32 +0800 Subject: [PATCH] Update Multiply.py --- Multiply.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Multiply.py b/Multiply.py index c8e1b52228f..7565ddbc838 100644 --- a/Multiply.py +++ b/Multiply.py @@ -1,4 +1,7 @@ def product(a, b): + if b < 0: + return -1 * product(a, -b) + if a < b: return product(b, a) elif b != 0: @@ -9,4 +12,4 @@ def product(a, b): a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) -print("Product is: ", product(a, b)) +print("Product is:", product(a, b))