Advertisement
elcocodrilotito

Guay MCD Euclides

Oct 16th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. #Voy a hacer el Máximo Común Divisor de n números con el algoritmo de Euclides
  2. n=int(input("Entre cuantos numeros quieres que te haga el maximo comun divisor "))
  3. a=int(input("Numero: "))
  4. for i in range(n-1):
  5.     b=int(input("Numero: "))
  6.     r=1
  7.     while r!=0:
  8.         r=a%b
  9.         a=b
  10.         b=r
  11. print("El maximo comun divisor es %d" %(a))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement