-
Lenguaje
Pascal
-
Descripción
Se ingresa por teclado una cierta cantidad de producto y el precio por unidad del producto. Calcular el importe, luego hacer un descuento del 5% si el importe es menor que S/. 100.00, si el importe esta entre S/.100.00 pero menor a S/.500.00 hacer el descuento del 10%, si el importe está entre S/500.00 pero menor que S/.1000.00 hacer el descuento del 15% y si el importe es mayor o igual que S/. 1000.00 hacer el descuento del 20%, luego calcular el descuento y el importe final a pagar.
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 BonificacionPorSueldo2;
uses crt;
var cantidad_de_producto, descuento, importe, importe_final, precio_por_unidad : real;
begin
write ('Ingresa el valor de cantidad de producto: ');
readln (cantidad_de_producto);
write ('Ingresa el valor de precio por unidad: ');
readln (precio_por_unidad);
importe := cantidad_de_producto*precio_por_unidad;
descuento := 0;
if importe<100 then
begin
descuento := importe*0.05;
end;
if (importe>=100) and (importe<=500) then
begin
descuento := importe*0.1;
end;
if (importe>500) and (importe<1000) then
begin
descuento := importe*0.15;
end;
if importe>=1000 then
begin
descuento := importe*0.2;
end;
importe_final := importe-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de importe: ', importe:0:6);
writeln ('Valor de importe final: ', importe_final:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var cantidad_de_producto, descuento, importe, importe_final, precio_por_unidad : real;
begin
write ('Ingresa el valor de cantidad de producto: ');
readln (cantidad_de_producto);
write ('Ingresa el valor de precio por unidad: ');
readln (precio_por_unidad);
importe := cantidad_de_producto*precio_por_unidad;
descuento := 0;
if importe<100 then
begin
descuento := importe*0.05;
end;
if (importe>=100) and (importe<=500) then
begin
descuento := importe*0.1;
end;
if (importe>500) and (importe<1000) then
begin
descuento := importe*0.15;
end;
if importe>=1000 then
begin
descuento := importe*0.2;
end;
importe_final := importe-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de importe: ', importe:0:6);
writeln ('Valor de importe final: ', importe_final:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.