• Lenguaje

    Pascal

  • Descripción

    Determinar lo que una empresa necesita calcular
    a. Total de hombres.
    b. Total de mujeres.
    c. Porcentaje de hombres.
    d. Porcentaje de mujeres.
    e. Promedio de las estaturas en hombres.
    f. Promedio de las estaturas en mujeres.
    g. Promedio de edades de todos los empleados.

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
program PromediosDeHombresYMujeres;
uses crt;

var a, b, edad, estatura, genero : integer;
var numero_de_empleados : integer;
var c, d, e, f, g : real;
var tecla_repetir : char;
begin
    a := 0;
    b := 0;
    numero_de_empleados := 0;
    c := 0;
    d := 0;
    e := 0;
    f := 0;
    g := 0;
    repeat
        clrscr;
        write ('Ingresa el valor de edad: ');
        readln (edad);
        write ('Ingresa el valor de estatura: ');
        readln (estatura);
        numero_de_empleados := numero_de_empleados+1;
        writeln ('Selecciona el valor de genero.');
        writeln ('    1.- Mujer');
        writeln ('    2.- Hombre');
        write ('    : ');
        repeat
            readln (genero);
            if (genero<1) or (genero>2) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (genero>=1) and (genero<=2);
        g := g+edad;
        if genero=1 then
            begin
                b := b+1;
                f := f+estatura;
            end
        else
            begin
                a := a+1;
                e := e+estatura;
            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');
    if numero_de_empleados = 0 then
        c := 0
    else
        c := 100.0*a/numero_de_empleados;
    if numero_de_empleados = 0 then
        d := 0
    else
        d := 100.0*b/numero_de_empleados;
    if a = 0 then
        e := 0
    else
        e := e/a;
    if b = 0 then
        f := 0
    else
        f := f/b;
    if numero_de_empleados = 0 then
        g := 0
    else
        g := g/numero_de_empleados;
    writeln ('Valor de a: ', a);
    writeln ('Valor de b: ', b);
    writeln ('Valor de numero de empleados: ', numero_de_empleados);
    writeln ('Valor de c: ', c:0:6);
    writeln ('Valor de d: ', d:0:6);
    writeln ('Valor de e: ', e:0:6);
    writeln ('Valor de f: ', f:0:6);
    writeln ('Valor de g: ', g:0:6);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.