diff options
Diffstat (limited to 'challenge-090/paulo-custodio/lua/ch-2.lua')
| -rw-r--r-- | challenge-090/paulo-custodio/lua/ch-2.lua | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/challenge-090/paulo-custodio/lua/ch-2.lua b/challenge-090/paulo-custodio/lua/ch-2.lua index c93074b04f..d9e54b052f 100644 --- a/challenge-090/paulo-custodio/lua/ch-2.lua +++ b/challenge-090/paulo-custodio/lua/ch-2.lua @@ -11,18 +11,18 @@ Write a script to demonstrate Ethiopian Multiplication using the given numbers. --]] function mul(a, b) - local m = 0 - while (true) do - if ((a & 1) ~= 0) then - m = m + b - end - if (a <= 1) then - break - end - a = a >> 1 - b = b << 1 - end - return m + local m = 0 + while (true) do + if ((a & 1) ~= 0) then + m = m + b + end + if (a <= 1) then + break + end + a = a >> 1 + b = b << 1 + end + return m end io.write(mul(tonumber(arg[1]), tonumber(arg[2])), "\n") |
