• Lenguaje

    Pascal

  • Descripción

    Permita leer las cantidades y los precios de 10 productos y permita saber cuanto debe pagar el cliente si el IVA es del 19% y tiene un descuento final del 2%. Al final muestre el valor a pagar por IVA y el valor total 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
program PagoPor10Productos;
uses crt;

var i : integer;
var IVA, cantidad_de_productos, descuento, importe, precio_del_producto : real;
var subtotal, total_a_pagar : real;
begin
    descuento := 0;
    IVA := 0;
    subtotal := 0;
    total_a_pagar := 0;
    for i:=1 to 10 do
    begin
        writeln ('PROCESO ', i);
        write ('Ingresa el valor de cantidad de productos: ');
        readln (cantidad_de_productos);
        write ('Ingresa el valor de precio del producto: ');
        readln (precio_del_producto);
        importe := cantidad_de_productos*precio_del_producto;
        subtotal := subtotal+importe;
        writeln ('Valor de importe: ', importe:0:6);
        writeln;
    end;
    descuento := subtotal*0.02;
    IVA := (subtotal-descuento)*0.19;
    total_a_pagar := subtotal-descuento+IVA;
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de IVA: ', IVA:0:6);
    writeln ('Valor de subtotal: ', subtotal:0:6);
    writeln ('Valor de total a pagar: ', total_a_pagar:0:6);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.