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/Roman-numerals-Encode/Lasso/roman-numerals-encode.lasso
Normal file
19
Task/Roman-numerals-Encode/Lasso/roman-numerals-encode.lasso
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
define br => '\r'
|
||||
// encode roman
|
||||
define encodeRoman(num::integer)::string => {
|
||||
local(ref = array('M'=1000, 'CM'=900, 'D'=500, 'CD'=400, 'C'=100, 'XC'=90, 'L'=50, 'XL'=40, 'X'=10, 'IX'=9, 'V'=5, 'IV'=4, 'I'=1))
|
||||
local(out = string)
|
||||
with i in #ref do => {
|
||||
while(#num >= #i->second) => {
|
||||
#out->append(#i->first)
|
||||
#num -= #i->second
|
||||
}
|
||||
}
|
||||
return #out
|
||||
}
|
||||
|
||||
'1990 in roman is '+encodeRoman(1990)
|
||||
br
|
||||
'2008 in roman is '+encodeRoman(2008)
|
||||
br
|
||||
'1666 in roman is '+encodeRoman(1666)
|
||||
Loading…
Add table
Add a link
Reference in a new issue