Create a Python script which will accept two positive integers and will display the COMMON DIVISORS.
Sample Output:
Positive Integer 1:20 Positive Integer 2: 12
COMMON DIVISORS of 20 and 12 are....
1 2 4
print('Enter positive Integer 1: ', end='')
n1 = int(input())
print('Enter positive Integer 2: ', end='')
n2 = int(input())
print(f'COMMON DIVISORS of {n1} and {n2} are: ')
if n2 < n1:
n = n2
else:
n = n1
for i in range (1, n):
if (n2 % i == 0) & (n1 % i == 0):
print(i, end=' ')
Comments
Leave a comment