• Lenguaje

    Pascal

  • Descripción

    Convierte un dígito dado por el usuario en su equivalente en número romano. Repite el proceso si el usuario así lo desea.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
program UnDigitoANumeroRomano;
uses crt;

var digito : integer;
var tecla_repetir : char;
begin
    repeat
        clrscr;
        write ('Ingresa el valor de digito: ');
        readln (digito);
        if digito=1 then
            begin
                writeln ('I');
            end;
        if digito=2 then
            begin
                writeln ('II');
            end;
        if digito=3 then
            begin
                writeln ('III');
            end;
        if digito=4 then
            begin
                writeln ('IV');
            end;
        if digito=5 then
            begin
                writeln ('V');
            end;
        if digito=6 then
            begin
                writeln ('VI');
            end;
        if digito=7 then
            begin
                writeln ('VII');
            end;
        if digito=8 then
            begin
                writeln ('VIII');
            end;
        if digito=9 then
            begin
                writeln ('IX');
            end;
        writeln;
        write (#168'Deseas repetir el proceso? (S/N): ');
        repeat
            tecla_repetir := readkey;
        until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
    until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.