-
Lenguaje
Pascal
-
Descripción
Se desea saber cuánto tendrá que pagar una persona por la compra de un artículo en base a las siguientes condiciones. Si compra menos de 5 del mismo artículo se le hará un descuento del 10% sobre el total de su compra. Si compra 5 o más, pero menos de 10 se le hace un 15% de descuento. Si compra más de 10 pero menos de 15 se le hace un 20% de descuento y en caso contrario se le hará un 25% de descuento sobre su compra.
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
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
program DescuentoPorUnArticulo;
uses crt;
var cantidad, descuento, pago, precio_del_articulo, subtotal : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
write ('Ingresa el valor de precio del articulo: ');
readln (precio_del_articulo);
descuento := 0;
subtotal := precio_del_articulo*cantidad;
if cantidad<5 then
begin
descuento := subtotal*0.1;
end;
if (cantidad>=5) and (cantidad<10) then
begin
descuento := subtotal*0.15;
end;
if (cantidad>=10) and (cantidad<15) then
begin
descuento := subtotal*0.2;
end;
if cantidad>=15 then
begin
descuento := subtotal*0.25;
end;
pago := subtotal-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de pago: ', pago:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var cantidad, descuento, pago, precio_del_articulo, subtotal : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
write ('Ingresa el valor de precio del articulo: ');
readln (precio_del_articulo);
descuento := 0;
subtotal := precio_del_articulo*cantidad;
if cantidad<5 then
begin
descuento := subtotal*0.1;
end;
if (cantidad>=5) and (cantidad<10) then
begin
descuento := subtotal*0.15;
end;
if (cantidad>=10) and (cantidad<15) then
begin
descuento := subtotal*0.2;
end;
if cantidad>=15 then
begin
descuento := subtotal*0.25;
end;
pago := subtotal-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de pago: ', pago:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.