Answer the question
In order to leave comments, you need to log in
Displays 0 instead of max number, why?
const n = 1000;
var
i,m: integer;
a: array [1..n] of integer;
l: integer;
function max(k: byte; var max: real): integer;
begin
var i: integer;
max:=0;
for i := 1 to k do
if (a[i] > max) then
begin
max:=a[i];
end;
end;
begin
write('Введите размерность массива: ');
readln(m);
for i:=1 to m do
begin
a[i]:=random(50);
write(a[i],' ');
end;
writeln();
max(m,l);
writeln('Максимальный элемент массива = ',l);
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question