-
Lenguaje
Pascal
-
Descripción
Capturar la estatura de los estudiantes del grupo y mostrar por pantalla el promedio de estatura de las mujeres y hombres, el porcentaje de mujeres y hombres que hay en el grupo.
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
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
program EstaturaDeEstudiantes;
uses crt;
var estudiantes, genero, hombres, mujeres : integer;
var estatura, porcentaje_hombres, porcentaje_mujeres, promedio_hombres, promedio_mujeres : real;
var tecla_repetir : char;
begin
estudiantes := 0;
hombres := 0;
mujeres := 0;
porcentaje_hombres := 0;
porcentaje_mujeres := 0;
promedio_hombres := 0;
promedio_mujeres := 0;
repeat
clrscr;
write ('Ingresa el valor de estatura: ');
readln (estatura);
writeln ('Selecciona el valor de genero.');
writeln (' 1.- Hombre');
writeln (' 2.- Mujer');
write (' : ');
repeat
readln (genero);
if (genero<1) or (genero>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (genero>=1) and (genero<=2);
if genero=1 then
begin
hombres := hombres+1;
promedio_hombres := promedio_hombres+estatura;
end
else
begin
mujeres := mujeres+1;
promedio_mujeres := promedio_mujeres+estatura;
end;
estudiantes := estudiantes+1;
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 estudiantes = 0 then
porcentaje_hombres := 0
else
porcentaje_hombres := 100.0*hombres/estudiantes;
if estudiantes = 0 then
porcentaje_mujeres := 0
else
porcentaje_mujeres := 100.0*mujeres/estudiantes;
if hombres = 0 then
promedio_hombres := 0
else
promedio_hombres := promedio_hombres/hombres;
if mujeres = 0 then
promedio_mujeres := 0
else
promedio_mujeres := promedio_mujeres/mujeres;
writeln ('Valor de estudiantes: ', estudiantes);
writeln ('Valor de hombres: ', hombres);
writeln ('Valor de mujeres: ', mujeres);
writeln ('Valor de porcentaje hombres: ', porcentaje_hombres:0:6);
writeln ('Valor de porcentaje mujeres: ', porcentaje_mujeres:0:6);
writeln ('Valor de promedio hombres: ', promedio_hombres:0:6);
writeln ('Valor de promedio mujeres: ', promedio_mujeres:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var estudiantes, genero, hombres, mujeres : integer;
var estatura, porcentaje_hombres, porcentaje_mujeres, promedio_hombres, promedio_mujeres : real;
var tecla_repetir : char;
begin
estudiantes := 0;
hombres := 0;
mujeres := 0;
porcentaje_hombres := 0;
porcentaje_mujeres := 0;
promedio_hombres := 0;
promedio_mujeres := 0;
repeat
clrscr;
write ('Ingresa el valor de estatura: ');
readln (estatura);
writeln ('Selecciona el valor de genero.');
writeln (' 1.- Hombre');
writeln (' 2.- Mujer');
write (' : ');
repeat
readln (genero);
if (genero<1) or (genero>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (genero>=1) and (genero<=2);
if genero=1 then
begin
hombres := hombres+1;
promedio_hombres := promedio_hombres+estatura;
end
else
begin
mujeres := mujeres+1;
promedio_mujeres := promedio_mujeres+estatura;
end;
estudiantes := estudiantes+1;
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 estudiantes = 0 then
porcentaje_hombres := 0
else
porcentaje_hombres := 100.0*hombres/estudiantes;
if estudiantes = 0 then
porcentaje_mujeres := 0
else
porcentaje_mujeres := 100.0*mujeres/estudiantes;
if hombres = 0 then
promedio_hombres := 0
else
promedio_hombres := promedio_hombres/hombres;
if mujeres = 0 then
promedio_mujeres := 0
else
promedio_mujeres := promedio_mujeres/mujeres;
writeln ('Valor de estudiantes: ', estudiantes);
writeln ('Valor de hombres: ', hombres);
writeln ('Valor de mujeres: ', mujeres);
writeln ('Valor de porcentaje hombres: ', porcentaje_hombres:0:6);
writeln ('Valor de porcentaje mujeres: ', porcentaje_mujeres:0:6);
writeln ('Valor de promedio hombres: ', promedio_hombres:0:6);
writeln ('Valor de promedio mujeres: ', promedio_mujeres:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.