Common Factors (X, Y) and (Y, Z): The Program must accept three integers X, Y, Z as the input. The program must find the common factors of X, Y. Then the program must find the common factors of Y and Z. Finally, the program must print all the factors obtained in descending order as the output.

Input:
24 100 80

Output:
20 10 5 4 4 2 2 1 1

X,Y,Z=map(int,input().split())
for Index in range(Y,0,-1):
    if X % Index==0 and Y % Index==0:
        print(Index,end=" ")
    if Y % Index==0 and Z % Index==0:
        print(Index,end=" ")
Amazing!
1
Love
2
Very helpful
2
Claps!
1

You may also like

More in:Python