-
Lenguaje
Pascal
-
Descripción
El comité olímpico colombiano desea automatizar la evaluación de resultados de las competencias individuales que se llevan a cabo en distintos deportes, para lo cual es necesario implementar un software que este en capacidad de solicitar al usuario la cantidad de deportistas que participaron del evento y posteriormente solicitar la categoría de cada uno de ellos, teniendo en cuenta solo existen las siguientes categorías:
- Categoría Juvenil
- Categoría Elite
- Categoría Máster
En consecuencia, se debe de llevar un registro de cuantos deportistas participaron por cada categoría y calcular cual es el porcentaje de cada una de ellas frente al total de participantes.
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
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
program ComiteOlimpicoColombiano;
uses crt;
var categoria, deposrtistas_elite, deposrtistas_juveniles, deposrtistas_master, i : integer;
var n : integer;
var porcentaje_elite, porcentaje_juveniles, porcentaje_master : real;
begin
deposrtistas_elite := 0;
deposrtistas_juveniles := 0;
deposrtistas_master := 0;
porcentaje_elite := 0;
porcentaje_juveniles := 0;
porcentaje_master := 0;
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
writeln ('Selecciona el valor de categoria.');
writeln (' 1.- Juvenil');
writeln (' 2.- Elite');
writeln (' 3.- M'#160'ster');
write (' : ');
repeat
readln (categoria);
if (categoria<1) or (categoria>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (categoria>=1) and (categoria<=3);
if categoria=1 then
begin
deposrtistas_juveniles := deposrtistas_juveniles+1;
end;
if categoria=2 then
begin
deposrtistas_elite := deposrtistas_elite+1;
end;
if categoria=3 then
begin
deposrtistas_master := deposrtistas_master+1;
end;
writeln;
end;
if n = 0 then
porcentaje_elite := 0
else
porcentaje_elite := 100.0*deposrtistas_elite/n;
if n = 0 then
porcentaje_juveniles := 0
else
porcentaje_juveniles := 100.0*deposrtistas_juveniles/n;
if n = 0 then
porcentaje_master := 0
else
porcentaje_master := 100.0*deposrtistas_master/n;
writeln ('Valor de deposrtistas elite: ', deposrtistas_elite);
writeln ('Valor de deposrtistas juveniles: ', deposrtistas_juveniles);
writeln ('Valor de deposrtistas master: ', deposrtistas_master);
writeln ('Valor de porcentaje elite: ', porcentaje_elite:0:6);
writeln ('Valor de porcentaje juveniles: ', porcentaje_juveniles:0:6);
writeln ('Valor de porcentaje master: ', porcentaje_master:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var categoria, deposrtistas_elite, deposrtistas_juveniles, deposrtistas_master, i : integer;
var n : integer;
var porcentaje_elite, porcentaje_juveniles, porcentaje_master : real;
begin
deposrtistas_elite := 0;
deposrtistas_juveniles := 0;
deposrtistas_master := 0;
porcentaje_elite := 0;
porcentaje_juveniles := 0;
porcentaje_master := 0;
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
writeln ('Selecciona el valor de categoria.');
writeln (' 1.- Juvenil');
writeln (' 2.- Elite');
writeln (' 3.- M'#160'ster');
write (' : ');
repeat
readln (categoria);
if (categoria<1) or (categoria>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (categoria>=1) and (categoria<=3);
if categoria=1 then
begin
deposrtistas_juveniles := deposrtistas_juveniles+1;
end;
if categoria=2 then
begin
deposrtistas_elite := deposrtistas_elite+1;
end;
if categoria=3 then
begin
deposrtistas_master := deposrtistas_master+1;
end;
writeln;
end;
if n = 0 then
porcentaje_elite := 0
else
porcentaje_elite := 100.0*deposrtistas_elite/n;
if n = 0 then
porcentaje_juveniles := 0
else
porcentaje_juveniles := 100.0*deposrtistas_juveniles/n;
if n = 0 then
porcentaje_master := 0
else
porcentaje_master := 100.0*deposrtistas_master/n;
writeln ('Valor de deposrtistas elite: ', deposrtistas_elite);
writeln ('Valor de deposrtistas juveniles: ', deposrtistas_juveniles);
writeln ('Valor de deposrtistas master: ', deposrtistas_master);
writeln ('Valor de porcentaje elite: ', porcentaje_elite:0:6);
writeln ('Valor de porcentaje juveniles: ', porcentaje_juveniles:0:6);
writeln ('Valor de porcentaje master: ', porcentaje_master:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.