-
Lenguaje
Pascal
-
Descripción
Captura el precio de 5 productos, después ubica la posición de precio menor.
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
program MenorYPosicionDe5Productos;
uses crt;
var i, posicion : integer;
var menor, precio : real;
begin
posicion := 0;
menor := 0;
for i:=1 to 5 do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de precio: ');
readln (precio);
if (i=1) or (menor>precio) then
begin
menor := precio;
posicion := i;
end;
writeln;
end;
writeln ('Valor de posicion: ', posicion);
writeln ('Valor de menor: ', menor:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var i, posicion : integer;
var menor, precio : real;
begin
posicion := 0;
menor := 0;
for i:=1 to 5 do
begin
writeln ('PROCESO ', i);
write ('Ingresa el valor de precio: ');
readln (precio);
if (i=1) or (menor>precio) then
begin
menor := precio;
posicion := i;
end;
writeln;
end;
writeln ('Valor de posicion: ', posicion);
writeln ('Valor de menor: ', menor:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.