• Lenguaje

    Pascal

  • Descripción

    Se solicita que se calcule las ventas por productos por día y obtener un porcentaje del 5% del total de las ventas.

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
program _5PorcientoEnVentas;
uses crt;

var numero_de_productos, porcentaje, precio_del_producto, total_de_las_ventas, venta : real;
var tecla_repetir : char;
begin
    porcentaje := 0;
    total_de_las_ventas := 0;
    repeat
        clrscr;
        write ('Ingresa el valor de numero de productos: ');
        readln (numero_de_productos);
        write ('Ingresa el valor de precio del producto: ');
        readln (precio_del_producto);
        venta := numero_de_productos*precio_del_producto;
        total_de_las_ventas := total_de_las_ventas+venta;
        writeln ('Valor de venta: ', venta: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');
    porcentaje := total_de_las_ventas*0.05;
    writeln ('Valor de porcentaje: ', porcentaje:0:6);
    writeln ('Valor de total de las ventas: ', total_de_las_ventas:0:6);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.