-
Lenguaje
Pascal
-
Descripción
Dado el monto de una compra calcular el descuento considerado:
- Descuento es 10% si el monto es mayor a 100.
- Descuento es 20% si el monto es mayor a 50 y menor o igual a 100.
- No hay descuento si el monto es menor o igual a $50.
Imprimir total a pagar de cada 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
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
program DescuentoPorUnaCompra;
uses crt;
var descuento, monto, total_a_pagar : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de monto: ');
readln (monto);
descuento := 0;
if (monto>=50) and (monto<100) then
begin
descuento := monto*0.2;
end;
if monto>100 then
begin
descuento := monto*0.1;
end;
total_a_pagar := monto-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de total a pagar: ', total_a_pagar:0:6);
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.
uses crt;
var descuento, monto, total_a_pagar : real;
var tecla_repetir : char;
begin
repeat
clrscr;
write ('Ingresa el valor de monto: ');
readln (monto);
descuento := 0;
if (monto>=50) and (monto<100) then
begin
descuento := monto*0.2;
end;
if monto>100 then
begin
descuento := monto*0.1;
end;
total_a_pagar := monto-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de total a pagar: ', total_a_pagar:0:6);
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
end.