-
Lenguaje
Pascal
-
Descripción
El gerente de una compañía automotriz cuenta con los N importes de los autos vendidos en el mes de agosto. El gerente desea un algoritmo que realice un reporte con el auto más barato que se vendió, con la media de los importes, y el total de venta en el mes de agosto.
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
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 VentasDeAgosto;
uses crt;
var i, n : integer;
var auto_mas_barato, importe_del_auto, media, total_de_venta : real;
begin
auto_mas_barato := 0;
media := 0;
total_de_venta := 0;
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de importe del auto: ');
readln (importe_del_auto);
if (i=1) or (importe_del_auto<auto_mas_barato) then
begin
auto_mas_barato := importe_del_auto;
end;
total_de_venta := total_de_venta+importe_del_auto;
writeln;
end;
if n = 0 then
media := 0
else
media := total_de_venta/n;
writeln ('Valor de auto mas barato: ', auto_mas_barato:0:6);
writeln ('Valor de media: ', media:0:6);
writeln ('Valor de total de venta: ', total_de_venta:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var i, n : integer;
var auto_mas_barato, importe_del_auto, media, total_de_venta : real;
begin
auto_mas_barato := 0;
media := 0;
total_de_venta := 0;
write ('Ingresa el valor de n: ');
readln (n);
for i:=1 to n do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de importe del auto: ');
readln (importe_del_auto);
if (i=1) or (importe_del_auto<auto_mas_barato) then
begin
auto_mas_barato := importe_del_auto;
end;
total_de_venta := total_de_venta+importe_del_auto;
writeln;
end;
if n = 0 then
media := 0
else
media := total_de_venta/n;
writeln ('Valor de auto mas barato: ', auto_mas_barato:0:6);
writeln ('Valor de media: ', media:0:6);
writeln ('Valor de total de venta: ', total_de_venta:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.