home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: WPS_PM
/
WPS_PM.zip
/
ICONPL2.ZIP
/
SAMPLES.ARC
/
ROMAN.ICN
< prev
Wrap
Text File
|
1985-09-08
|
612b
|
24 lines
#
# R O M A N N U M E R A L S
#
# This program takes Arabic numerals from standard input and writes
# the corresponding Roman numerals to standard outout.
procedure main()
local n
while n := read() do
write(roman(n) | "cannot convert")
end
procedure roman(n)
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