-
Lenguaje
Pascal
-
Descripción
Permita ingresar por pantalla los siguientes datos:
- EDAD,
- SEXO (1=hombre, 2=mujer)
- TIPO (1=alto, 2=bajo, 3=medio)
- NACIONALIDAD (1=latino, 2=alemán, 3=hindú, 4=colombiano)
- VALOR.
Realizar lo siguiente:
- Sí la persona es mujer, de tipo alto, la edad se encuentra entre 35 y 45, se triplica el valor que tiene.
- Sí es hombre latino de tipo medio y menor de 30 años, el valor que tiene se divide por 3.
- Sí es mujer hindú mayor a 55 años, réstele al valor $50,000.
Mostrar el valor resultante de la persona.
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
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
program GeneroTipoYNacionalidad;
uses crt;
var nacionalidad, sexo, tipo : integer;
var edad, resultado, un_valor : real;
begin
write ('Ingresa el valor de edad: ');
readln (edad);
write ('Ingresa el valor de un valor: ');
readln (un_valor);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- hombre');
writeln (' 2.- mujer');
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 tipo.');
writeln (' 1.- alto');
writeln (' 2.- bajo');
writeln (' 3.- medio');
write (' : ');
repeat
readln (tipo);
if (tipo<1) or (tipo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo>=1) and (tipo<=3);
writeln ('Selecciona el valor de nacionalidad.');
writeln (' 1.- latino');
writeln (' 2.- alem'#160'n');
writeln (' 3.- hind'#163);
writeln (' 4.- colombiano');
write (' : ');
repeat
readln (nacionalidad);
if (nacionalidad<1) or (nacionalidad>4) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (nacionalidad>=1) and (nacionalidad<=4);
resultado := un_valor;
if (sexo=2) and (tipo=1) and (edad>=35) and (edad<=45) then
begin
resultado := resultado*3;
end;
if (sexo=1) and (nacionalidad=1) and (tipo=3) and (edad<30) then
begin
resultado := resultado/3;
end;
if (sexo=2) and (nacionalidad=3) and (edad>55) then
begin
resultado := resultado-50000;
end;
writeln ('Valor de resultado: ', resultado:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var nacionalidad, sexo, tipo : integer;
var edad, resultado, un_valor : real;
begin
write ('Ingresa el valor de edad: ');
readln (edad);
write ('Ingresa el valor de un valor: ');
readln (un_valor);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- hombre');
writeln (' 2.- mujer');
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 tipo.');
writeln (' 1.- alto');
writeln (' 2.- bajo');
writeln (' 3.- medio');
write (' : ');
repeat
readln (tipo);
if (tipo<1) or (tipo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo>=1) and (tipo<=3);
writeln ('Selecciona el valor de nacionalidad.');
writeln (' 1.- latino');
writeln (' 2.- alem'#160'n');
writeln (' 3.- hind'#163);
writeln (' 4.- colombiano');
write (' : ');
repeat
readln (nacionalidad);
if (nacionalidad<1) or (nacionalidad>4) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (nacionalidad>=1) and (nacionalidad<=4);
resultado := un_valor;
if (sexo=2) and (tipo=1) and (edad>=35) and (edad<=45) then
begin
resultado := resultado*3;
end;
if (sexo=1) and (nacionalidad=1) and (tipo=3) and (edad<30) then
begin
resultado := resultado/3;
end;
if (sexo=2) and (nacionalidad=3) and (edad>55) then
begin
resultado := resultado-50000;
end;
writeln ('Valor de resultado: ', resultado:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.