-
Lenguaje
Pascal
-
Descripción
Determinar el precio a pagar en la compra de un par de zapatos con un precio de $100 considerando el descuento de temporada.
Tenis 15%
Botas 10%
Zapatillas 20%
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
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
program CompraDeUnParDeZapatos;
uses crt;
var par_de_zapatos : integer;
var descuento, precio, precio_a_pagar : real;
begin
writeln ('Selecciona el valor de par de zapatos.');
writeln (' 1.- Tenis');
writeln (' 2.- Botas');
writeln (' 3.- Zapatillas');
write (' : ');
repeat
readln (par_de_zapatos);
if (par_de_zapatos<1) or (par_de_zapatos>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (par_de_zapatos>=1) and (par_de_zapatos<=3);
precio := 100;
descuento := 0;
if par_de_zapatos=1 then
begin
descuento := precio*0.15;
end;
if par_de_zapatos=2 then
begin
descuento := precio*0.1;
end;
if par_de_zapatos=3 then
begin
descuento := precio*0.2;
end;
precio_a_pagar := precio-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de precio a pagar: ', precio_a_pagar:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var par_de_zapatos : integer;
var descuento, precio, precio_a_pagar : real;
begin
writeln ('Selecciona el valor de par de zapatos.');
writeln (' 1.- Tenis');
writeln (' 2.- Botas');
writeln (' 3.- Zapatillas');
write (' : ');
repeat
readln (par_de_zapatos);
if (par_de_zapatos<1) or (par_de_zapatos>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (par_de_zapatos>=1) and (par_de_zapatos<=3);
precio := 100;
descuento := 0;
if par_de_zapatos=1 then
begin
descuento := precio*0.15;
end;
if par_de_zapatos=2 then
begin
descuento := precio*0.1;
end;
if par_de_zapatos=3 then
begin
descuento := precio*0.2;
end;
precio_a_pagar := precio-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de precio a pagar: ', precio_a_pagar:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.