Создать массив из n элементов и найти максимальное значение. n=29- Pascal(Паскаль)

const
  n = 29;

var
  arr: array [1 .. n] of integer;
  i, max: integer;

begin
  for i := 1 to n do
    readln(a[i]);
  max := 1;
  for i := 1 to n do
    if a[i] > arr[max] then
      max := i;
  writeln('Макс ', arr[max], ' Под индексом ', max);

end.

Leave a Comment

+ 6 = 7