Home > other >  Bosses come in
Bosses come in

Time:09-19

CodePudding user response:

Def the GCD (x, y) : # greatest common divisor
If x & gt; Y:
Smaller=y
The else:
Smaller=x
For I in range (1, smaller + 1) :
If x % I==0 and y % I==0:
The GCD=I
Return the GCD


Def LCM (x, y) : # LCM
If x & gt; Y:
Greater=x
The else:
Greater=y
While True:
If greater and greater % % x==0 y==0:
LCM=greater
Break
Greater +=1
Return LCM

N1=int (input ())
N2=int (input ())
Print (GCD (n1, and n2), LCM (n1, and n2))
  • Related