Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import math
- loop=True
- def mcd(a, b):
- resto = 0
- while(b > 0):
- resto = b
- b = a % b
- a = resto
- return a
- while loop:
- dentro = True
- while dentro:
- entrega = input("Introduce A y B: ")
- data = entrega.split(" ",2)
- numA = int(data[0])
- numB = int(data[1])
- if numA==numB==0:
- print("Adios!")
- loop = False
- break
- if numA>10000 or numA<0:
- print("numero A fuera del rango")
- dentro = True
- continue
- if numB>10000 or numB<1:
- print("numero B fuera del rango")
- dentro = True
- continue
- else:
- dentro = False
- if numA>=0 and numA<10000 and numB>=1 and numB<10000:
- num1AFac = math.factorial(numA)
- print("El máximo común divisor de "+str(numA)+"! y ", numB," es ", mcd(num1AFac, numB))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement