Apr-02-2019, 12:47 AM
Good evening everyone, i m trying to compute GCD and LCM of n numbers and i can only do GCD and LCM for two integer numbers. I need your help and/or direction on this problem.
while True: x=int(input('Enter a number:')) if x==0: break else: y=int(input('Enter a number:')) temp1= x temp2=y while temp2 !=0: t= temp2 temp2=temp1%temp2 temp1= t gcd = temp1 lcm = (x*y)/gcd print("GCD =",gcd) print("LCM =", int(lcm))