Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def divisor(n) :
- T1 = ()
- for i in range(1 , n+1) :
- if n%i == 0:
- T1 += (i,)
- return T1
- def main() :
- a = int(input("Enter a number : "))
- b = int(input("Enter another number : "))
- common = []
- T1 = divisor(a)
- T2 = divisor(b)
- for i in T1 :
- for j in T2 :
- if i == j:
- common.append(i)
- hcf = max(common)
- lcm = int((a*b)/hcf)
- print("Highest common factor : " , hcf)
- print("Least common multiple : " , lcm)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement