Files
mathgenerator/mathgenerator/funcs/lcmFunc.py
2020-10-19 20:33:18 -04:00

23 lines
428 B
Python

from .__init__ import *
from ..__init__ import Generator
def lcmFunc(maxVal=20):
a = random.randint(1, maxVal)
b = random.randint(1, maxVal)
c = a * b
x, y = a, b
while y:
x, y = y, x % y
d = c // x
problem = f"LCM of {a} and {b} ="
solution = str(d)
return problem, solution
lcm = Generator("LCM (Least Common Multiple)", 9, "LCM of a and b = ", "c",
lcmFunc)