Create a Python script which will accept two positive integers and will display the COMMON DIVISORS.
I need the code to have an output.
'''
Create a Python script which will accept two positive integers
and will display the COMMON DIVISORS.
I need the code to have an output.
'''
x=0
y=0
while(x<=0):
x = int(input("Enter first number (>0): "))
while(y<=0):
y = int(input("Enter second number (>0): "))
common_Div = []
for r in range(1, min(x, y)+1):
if (x%r == 0 and y%r == 0):
common_Div.append(r)
print(common_Div)
Comments
Leave a comment