Skip to content

Instantly share code, notes, and snippets.

@agnel
Created August 15, 2024 08:00
Show Gist options
  • Save agnel/9db8f50ab7589c33c07f12fae65916b1 to your computer and use it in GitHub Desktop.
Save agnel/9db8f50ab7589c33c07f12fae65916b1 to your computer and use it in GitHub Desktop.
GCD of two numbers using while loop in python
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