-
Lenguaje
Pascal
-
Descripción
Una oficina de seguros ha reunido datos concernientes a todos los accidentes de tránsito ocurridos en el área metropolitana de Monterrey en el último año. Por cada conductor involucrado en un accidente se toman los siguientes datos: año de nacimiento, sexo (1: Femenino, 2: Masculino), registro del carro (1: Monterrey. 2: Otras ciudades).
a) Porcentaje de conductores menores de 25 años.
b) Porcentaje de conductores del sexo femenino.
c) Porcentaje de conductores masculinos con edades entre 12 y 30 años.
d) Porcentaje de conductores cuyos carros están registrados fuera de Monterrey.
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
81
82
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
81
82
program AccidentesDeTransitoEnMonterrey;
uses crt;
var ano_actual, ano_de_nacimiento, edad, registro_del_carro, sexo : integer;
var a, b, c, d : real;
var tecla_repetir : char;
begin
a := 0;
b := 0;
c := 0;
d := 0;
write ('Ingresa el valor de ano actual: ');
readln (ano_actual);
repeat
clrscr;
write ('Ingresa el valor de ano de nacimiento: ');
readln (ano_de_nacimiento);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- Femenino');
writeln (' 2.- Masculino');
write (' : ');
repeat
readln (sexo);
if (sexo<1) or (sexo>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (sexo>=1) and (sexo<=2);
writeln ('Selecciona el valor de registro del carro.');
writeln (' 1.- Monterrey');
writeln (' 2.- Otras ciudades');
write (' : ');
repeat
readln (registro_del_carro);
if (registro_del_carro<1) or (registro_del_carro>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (registro_del_carro>=1) and (registro_del_carro<=2);
edad := ano_actual-ano_de_nacimiento;
if edad<25 then
begin
a := a+1;
end;
if sexo=1 then
begin
b := b+1;
end;
if (sexo=2) and (edad=>12) and (edad<=30) then
begin
c := c+1;
end;
if registro_del_carro=2 then
begin
d := d+1;
end;
writeln ('Valor de edad: ', edad);
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 n = 0 then
a := 0
else
a := 100.0*a/n;
if n = 0 then
b := 0
else
b := 100.0*b/n;
if n = 0 then
c := 0
else
c := 100.0*c/n;
if n = 0 then
d := 0
else
d := 100.0*d/n;
writeln ('Valor de a: ', a:0:6);
writeln ('Valor de b: ', b:0:6);
writeln ('Valor de c: ', c:0:6);
writeln ('Valor de d: ', d:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var ano_actual, ano_de_nacimiento, edad, registro_del_carro, sexo : integer;
var a, b, c, d : real;
var tecla_repetir : char;
begin
a := 0;
b := 0;
c := 0;
d := 0;
write ('Ingresa el valor de ano actual: ');
readln (ano_actual);
repeat
clrscr;
write ('Ingresa el valor de ano de nacimiento: ');
readln (ano_de_nacimiento);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- Femenino');
writeln (' 2.- Masculino');
write (' : ');
repeat
readln (sexo);
if (sexo<1) or (sexo>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (sexo>=1) and (sexo<=2);
writeln ('Selecciona el valor de registro del carro.');
writeln (' 1.- Monterrey');
writeln (' 2.- Otras ciudades');
write (' : ');
repeat
readln (registro_del_carro);
if (registro_del_carro<1) or (registro_del_carro>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (registro_del_carro>=1) and (registro_del_carro<=2);
edad := ano_actual-ano_de_nacimiento;
if edad<25 then
begin
a := a+1;
end;
if sexo=1 then
begin
b := b+1;
end;
if (sexo=2) and (edad=>12) and (edad<=30) then
begin
c := c+1;
end;
if registro_del_carro=2 then
begin
d := d+1;
end;
writeln ('Valor de edad: ', edad);
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 n = 0 then
a := 0
else
a := 100.0*a/n;
if n = 0 then
b := 0
else
b := 100.0*b/n;
if n = 0 then
c := 0
else
c := 100.0*c/n;
if n = 0 then
d := 0
else
d := 100.0*d/n;
writeln ('Valor de a: ', a:0:6);
writeln ('Valor de b: ', b:0:6);
writeln ('Valor de c: ', c:0:6);
writeln ('Valor de d: ', d:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.