September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
9
Task/Roman-numerals-Encode/Zkl/roman-numerals-encode.zkl
Normal file
9
Task/Roman-numerals-Encode/Zkl/roman-numerals-encode.zkl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
var [const] romans = L(
|
||||
L("M", 1000), L("CM", 900), L("D", 500), L("CD", 400), L("C", 100),
|
||||
L("XC", 90), L("L", 50), L("XL", 40), L("X", 10), L("IX", 9),
|
||||
L("V", 5), L("IV", 4), L("I", 1));
|
||||
fcn toRoman(i){ // convert int to a roman number
|
||||
reg text = "";
|
||||
foreach R,N in (romans){ text += R*(i/N); i = i%N; }
|
||||
return(text);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue