Created
August 15, 2024 08:00
-
-
Save agnel/9db8f50ab7589c33c07f12fae65916b1 to your computer and use it in GitHub Desktop.
GCD of two numbers using while loop in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcd(a, b): | |
"""Compute the GCD of two numbers using the Euclidean algorithm.""" | |
while b != 0: | |
a, b = b, a % b | |
return a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment