From c82a48d166bf747b7cf92562ff2a64be4575292a Mon Sep 17 00:00:00 2001 From: aizu-Eiki-Mori Date: Thu, 21 Nov 2019 17:59:23 +0900 Subject: [PATCH] fix/lcm_normal.py --- src/algorithm/lcm_normal.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/algorithm/lcm_normal.py b/src/algorithm/lcm_normal.py index 6c018ed..94b4103 100644 --- a/src/algorithm/lcm_normal.py +++ b/src/algorithm/lcm_normal.py @@ -5,4 +5,18 @@ # CANNOT use library def lcm(a, b): - return 0 + storea = a + storeb = b + if(b > a): + temp = a + a = b + b = temp + + r = a % b + while(r != 0): + a = b + b = r + r = a % b + + + return (storea * storeb) / b