Last active
October 25, 2016 17:08
-
-
Save Hyrtwol/b5742d0734bc56047c2b1f7ef0f09e36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program roman(output); | |
var | |
x, y : integer; | |
begin y := 1; | |
repeat x := y; write(x:12, ' '); | |
while x >= 1000 do | |
begin write('m'); x := x - 1000 end; | |
if x >= 500 then | |
begin write('d'); x := x - 500 end; | |
while x >= 100 do | |
begin write('c'); x := x - 100 end; | |
if x >= 50 then | |
begin write('l'); x := x - 50 end; | |
while x >= 10 do | |
begin write('x'); x := x - 10 end; | |
if x >= 5 then | |
begin write('v'); x := x - 5 end; | |
while x >= 1 do | |
begin write('i'); x := x - 1 end; | |
writeln; y := 2 * y | |
until y > 5000 | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment