• 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 de 5% si el importe es menor que S/. 100,00, si el importe esta entre S/100 y S/. 500 hacer el descuento de 10% y si el importe es mayor a S/.500 hacer un descuento del 15%, 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
program DescuentoPorImporte2;
uses crt;

var cantidad_de_producto, descuento, importe, importe_final_a_pagar, 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.10;
        end;
    if importe>500 then
        begin
            descuento := importe*0.15;
        end;
    importe_final_a_pagar := importe-descuento;
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de importe: ', importe:0:6);
    writeln ('Valor de importe final a pagar: ', importe_final_a_pagar:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.