13 lines
361 B
Plaintext
13 lines
361 B
Plaintext
procedure roman(n) #: convert integer to Roman numeral
|
|
local arabic, result
|
|
static equiv
|
|
|
|
initial equiv := ["","I","II","III","IV","V","VI","VII","VIII","IX"]
|
|
|
|
integer(n) > 0 | fail
|
|
result := ""
|
|
every arabic := !n do
|
|
result := map(result,"IVXLCDM","XLCDM**") || equiv[arabic + 1]
|
|
if find("*",result) then fail else return result
|
|
end
|