• Lenguaje

    Pascal

  • Descripción

    En un zoológico desean saber cuántos niños menores de 10 años ingresan los días domingo.

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
program NinosMenoresDe10EnDomingo;
uses crt;

var dia, edad, ninos : integer;
var tecla_repetir : char;
begin
    ninos := 0;
    repeat
        clrscr;
        write ('Ingresa el valor de edad: ');
        readln (edad);
        writeln ('Selecciona el valor de dia.');
        writeln ('    1.- Domingo');
        writeln ('    2.- Lunes');
        writeln ('    3.- Martes');
        writeln ('    4.- Mi'#130'rcoles');
        writeln ('    5.- Jueves');
        writeln ('    6.- Viernes');
        writeln ('    7.- S'#160'bado');
        write ('    : ');
        repeat
            readln (dia);
            if (dia<1) or (dia>7) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (dia>=1) and (dia<=7);
        if (dia=1) and (edad<10) then
            begin
                ninos := ninos+1;
            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');
    writeln ('Valor de ninos: ', ninos);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.