-
Lenguaje
Pascal
-
Descripción
Un cliente llega a una venta de empanadas y pide una cantidad X, sabiendo que cada empanada cuesta Y BsF., cuanto debe pagar el cliente por su pedido si:
- Si el cliente compra más de 300 empanadas, se le dará un descuento del 30%.
- Si compra más de 200 y menos de 301, se le dará un descuento del 20%.
- Si compra más de 100 y menos de 201, se le dará un descuento del 10%.
- Si compra más de 50 y menos de 101, se le dará un descuento del 5%
- Entre 1 y 50 no tiene descuento.
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 VentaDeEmpanadas;
uses crt;
var Y_BsF, cantidad_X, descuento, subtotal, total : real;
begin
write ('Ingresa el valor de Y BsF: ');
readln (Y_BsF);
write ('Ingresa el valor de cantidad X: ');
readln (cantidad_X);
descuento := 0;
subtotal := Y_BsF*cantidad_X;
if cantidad_X>50 then
begin
descuento := subtotal*0.05;
end;
if cantidad_X>100 then
begin
descuento := subtotal*0.1;
end;
if cantidad_X>200 then
begin
descuento := subtotal*0.2;
end;
if cantidad_X>300 then
begin
descuento := subtotal*0.3;
end;
total := subtotal-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var Y_BsF, cantidad_X, descuento, subtotal, total : real;
begin
write ('Ingresa el valor de Y BsF: ');
readln (Y_BsF);
write ('Ingresa el valor de cantidad X: ');
readln (cantidad_X);
descuento := 0;
subtotal := Y_BsF*cantidad_X;
if cantidad_X>50 then
begin
descuento := subtotal*0.05;
end;
if cantidad_X>100 then
begin
descuento := subtotal*0.1;
end;
if cantidad_X>200 then
begin
descuento := subtotal*0.2;
end;
if cantidad_X>300 then
begin
descuento := subtotal*0.3;
end;
total := subtotal-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.