Найти максимальный элемент этого массива const n=20; var a: array[1..n] of integer; i,max: integer; begin randomize; for i:=1 to n do a[i]:= random(90)+10; for i:=1 to n do write(a[i]:4); writeln; for i:= to n do if a[i] then max:= ; writeln('max: ', ); end.
const n = 20; var a: array[1..n] of integer; i, max: integer; begin randomize; for i := 1 to n do a[i] := random(90) + 10; for i := 1 to n do write(a[i]:4); writeln; max := a[1]; for i := 2 to n do if a[i] > max then max := a[i]; writeln('max: ', max); end.
Исправленный код:
const
n = 20;
var
a: array[1..n] of integer;
i, max: integer;
begin
randomize;
for i := 1 to n do
a[i] := random(90) + 10;
for i := 1 to n do
write(a[i]:4);
writeln;
max := a[1];
for i := 2 to n do
if a[i] > max then
max := a[i];
writeln('max: ', max);
end.