Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (24 sloc) 682 Bytes
program roman(input, output);
var y: integer;
begin
read(y);
if (y<1) or (y>3999) then
write(StdErr, 'Only numbers from 1 to 3999 can be converted')
else
begin
while y>=1000 do
begin write('M'); y := y-1000 end;
if y>=500 then
begin write('D'); y := y-500 end;
while y>=100 do
begin write('C'); y := y-100 end;
if y>=50 then
begin write('L'); y := y-50 end;
while y>=10 do
begin write('X'); y := y-10 end;
if y>=5 then
begin write('V'); y := y-5 end;
while y>=1 do
begin write('I'); y := y-1 end;
end
end.
You can’t perform that action at this time.