const m=10;
var c:array[1..m] of integer;
max,min,i,j: integer;
begin
writeln('Массив:');
for i:=1 to m do
c[i]:=random(50);
write(c[i],' ');
end;
writeln;
max:=c[1];
min:=c[1];
for i:=2 to m do
if c[i]>max then max:=c[i];
if c[i]<min then min:=c[i];
writeln('max = ',max,' min = ',min,' max/min = ',max/min:5:2);
end.
Пример:
Массив:
27 29 35 42 30 42 27 42 21 31
max = 42 min = 21 max/min = 2.00
const m=10;
var c:array[1..m] of integer;
max,min,i,j: integer;
begin
writeln('Массив:');
for i:=1 to m do
begin
c[i]:=random(50);
write(c[i],' ');
end;
writeln;
max:=c[1];
min:=c[1];
for i:=2 to m do
begin
if c[i]>max then max:=c[i];
if c[i]<min then min:=c[i];
end;
writeln('max = ',max,' min = ',min,' max/min = ',max/min:5:2);
end.
Пример:
Массив:
27 29 35 42 30 42 27 42 21 31
max = 42 min = 21 max/min = 2.00