Write a procedure that prints a Roman numeral record of the number passed to it. Example: 2013 MMXIII

program zz1;
var
s: Array [1..4] of String;
n: Integer;
Procedure Inc4;
Begin
If (s [4] = ‘IV’) then s [4]: ​​= ‘V’ Else
If (s [4] = ‘VIII’) then s [4]: ​​= ‘IX’ Else
If (s [4] [1] = ‘I’) then If (Length (s [4]) <3) then s [4]: ​​= s [4] + ‘I’
Else s [4]: ​​= ‘IV’
Else s [4]: ​​= s [4] + ‘I’;
If (s [4] = ‘I’) then s [4]: ​​= ‘I’;
End;
Procedure Inc3;
Begin
If (s [3] = ‘XL’) then s [3]: = ‘L’ Else
If (s [3] = ‘LXXX’) then s [3]: = ‘XC’ Else
If (s [3] [1] = ‘X’) then If (Length (s [3]) <3) then s [3]: = s [3] + ‘X’
Else s [3]: = ‘XL’
Else s [3]: = s [3] + ‘X’; s [4]: ​​= ”;
If (s [3] = ‘X’) then s [3]: = ‘X’;
End;
Procedure Inc2;
Begin
If (s [2] = ‘CD’) then s [2]: = ‘D’ Else
If (s [2] = ‘DCCC’) then s [2]: = ‘CM’ Else
If (s [2] [1] = ‘C’) then If (Length (s [2]) <3) then s [2]: = s [2] + ‘C’
Else s [2]: = ‘CD’
Else s [2]: = s [2] + ‘C’; s [3]: = ”; s [4]: ​​= ”;
If (s [2] = ‘C’) then s [2]: = ‘C’;
End;
begin
Write (‘Please enter a number less than 4000:’); Read (n);
If (n> 3999) then n: = 3999; Write (n, ‘=’);
s [1]: = ”; s [2]: = ”; s [3]: = ”; s [4]: ​​= ”;
While (n> 0) do begin
Dec (n);
If (s [4] <> ‘IX’) then Inc4 Else
If (s [3] <> ‘XC’) then Inc3 Else
If (s [2] <> ‘CM’) then Inc2
Else begin
s [1]: = s [1] + ‘M’; s [2]: = ”; s [3]: = ”; s [4]: ​​= ”; End;
End;
For n: = 1 to 4 do If (s [n] <> ”) then Write (s [n]);
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.