Commit | Line | Data |
---|---|---|
fde98a2d BJ |
1 | program roman(output); |
2 | var | |
3 | x,y: integer; | |
4 | begin | |
5 | y := 1; | |
6 | repeat | |
7 | x := y; | |
8 | write(y, ' '); | |
9 | while x >= 1000 do | |
10 | begin | |
11 | write('m'); | |
12 | x := x-1000 | |
13 | end; | |
14 | while x >= 500 do | |
15 | begin | |
16 | write('d'); | |
17 | x := x-500 | |
18 | end; | |
19 | while x >= 100 do | |
20 | begin | |
21 | write('c'); | |
22 | x := x-100 | |
23 | end; | |
24 | if x >= 50 then | |
25 | begin | |
26 | write('l'); | |
27 | x := x-50 | |
28 | end; | |
29 | while x >= 10 do | |
30 | begin | |
31 | write('x'); | |
32 | x := x-10 | |
33 | end; | |
34 | if x >= 5 then | |
35 | begin | |
36 | write('v'); | |
37 | x := x-5 | |
38 | end; | |
39 | while x >= 1 do | |
40 | begin | |
41 | write('i'); | |
42 | x := x-1 | |
43 | end; | |
44 | writeln; | |
45 | y := 2*y; | |
46 | until y > 5000 | |
47 | end. |