From 9cc6a49de31de921e5d8610d8c60516a625cdbcd Mon Sep 17 00:00:00 2001 From: Harman Dhiman Date: Mon, 20 Apr 2026 12:37:18 +0530 Subject: [PATCH] Improve output message for hypotenuse calculation --- 2-variables/09_hypotenuse.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/2-variables/09_hypotenuse.py b/2-variables/09_hypotenuse.py index eb6b9e7..7fedd7c 100644 --- a/2-variables/09_hypotenuse.py +++ b/2-variables/09_hypotenuse.py @@ -4,6 +4,8 @@ a = int(input("Enter a: ")) b = int(input("Enter b: ")) -c = (a**2 + b**2) ** 0.5 - -print(c) +if a > 0 and b > 0: + c = (a**2 + b**2) ** 0.5 + print("Hypotenuse is:", c) +else: + print("Please enter positive numbers")