Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
19
Task/Least-common-multiple/Lasso/least-common-multiple.lasso
Normal file
19
Task/Least-common-multiple/Lasso/least-common-multiple.lasso
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
define gcd(a,b) => {
|
||||
while(#b != 0) => {
|
||||
local(t = #b)
|
||||
#b = #a % #b
|
||||
#a = #t
|
||||
}
|
||||
return #a
|
||||
}
|
||||
define lcm(m,n) => {
|
||||
#m == 0 || #n == 0 ? return 0
|
||||
local(r = (#m * #n) / decimal(gcd(#m, #n)))
|
||||
return integer(#r)->abs
|
||||
}
|
||||
|
||||
lcm(-6, 14)
|
||||
lcm(2, 0)
|
||||
lcm(12, 18)
|
||||
lcm(12, 22)
|
||||
lcm(7, 31)
|
||||
Loading…
Add table
Add a link
Reference in a new issue