mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
17 lines
371 B
Python
17 lines
371 B
Python
from .__init__ import *
|
|
|
|
|
|
def gcdFunc(maxVal=20):
|
|
a = random.randint(1, maxVal)
|
|
b = random.randint(1, maxVal)
|
|
x, y = a, b
|
|
while y:
|
|
x, y = y, x % y
|
|
problem = f"GCD of {a} and {b} = "
|
|
solution = str(x)
|
|
return problem, solution
|
|
|
|
|
|
gcd = Generator("GCD (Greatest Common Denominator)", 10, "GCD of a and b = ",
|
|
"c", gcdFunc)
|