We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents be1247e + 3ef079a commit b56fd88Copy full SHA for b56fd88
1 file changed
students_submissions/gcd_eliaszak.py
@@ -0,0 +1,14 @@
1
+def gcd(a: int, b: int) -> int:
2
+ if not isinstance(a, int) or not isinstance(b, int):
3
+ print("Error: Both inputs must be integers.")
4
+ return None
5
+ if a == 0 and b == 0:
6
+ print("Error: GCD is undefined for both inputs zero.")
7
8
+ if b == 0:
9
+ return abs(a)
10
+ return gcd(b, a % b)
11
+
12
+print(gcd(54, 24))
13
+print(gcd(48, 18))
14
+print(gcd(101, 10))
0 commit comments