diff options
Diffstat (limited to 'progs/a883.py')
-rw-r--r-- | progs/a883.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/progs/a883.py b/progs/a883.py new file mode 100644 index 0000000..a72df99 --- /dev/null +++ b/progs/a883.py @@ -0,0 +1,22 @@ +def find_lcm(num1, num2):
+ if(num1>num2):
+ num = num1
+ den = num2
+ else:
+ num = num2
+ den = num1
+ rem = num % den
+ while (rem != 0):
+ num = den
+ den = rem
+ rem = num % den
+ gcd = den
+ lcm = int(int(num1 * num2)/int(gcd))
+ return lcm
+def get_lcm(l):
+ num1 = l[0]
+ num2 = l[1]
+ lcm = find_lcm(num1, num2)
+ for i in range(2, len(l)):
+ lcm = find_lcm(lcm, l[i])
+ return lcm
\ No newline at end of file |