Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/mcm.py Secret

Created April 1, 2021 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/9ece1063aec59414eea50c42b99cdcc9 to your computer and use it in GitHub Desktop.
Save parzibyte/9ece1063aec59414eea50c42b99cdcc9 to your computer and use it in GitHub Desktop.
"""
https://parzibyte.me/blog
"""
# Necesitamos la función del MCD, puedes ver más en:
# https://parzibyte.me/blog/2021/03/30/python-maximo-comun-divisor/
def maximo_comun_divisor(a, b):
temporal = 0
while b != 0:
temporal = b
b = a % b
a = temporal
return a
def minimo_comun_multiplo(a, b):
return (a * b) / maximo_comun_divisor(a, b)
a = 20
b = 6
mcm = minimo_comun_multiplo(a, b)
print(f"El mínimo común múltiplo de {a} y {b} es {mcm}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment