Задача 7 Урок 15

Задача 7 Урок 15:

Пользователь вводит целые числа в цикле. Запишите в массив целых чисел (из 3 элементов) все нечетные отрицательные. Как только массив будет заполнен, завершите цикл ввода новых значений пользователем и распечатайте полученный массив.

type
  myArr = array[1..3] of integer;

procedure podprog(a2: myArr);
var j: integer;
begin
  for j := low(a2) to high(a2) do
    writeln(a2[j]);
end;

var i, w: integer;
  a: myArr;
begin
  i := 1;
  while(i <= high(a)) do
  begin
    writeln('vvedite chislo ');
    readln(w);
    if(w < 0) and (w mod 2 = -1) then
    begin
      a[i] := w;
      i += 1;
    end;
  end;
  writeln();
  podprog(a);
  readln();
end.     

Вывод консоли:

vvedite chislo
1
vvedite chislo
2
vvedite chislo
3
vvedite chislo
4
vvedite chislo
-1
vvedite chislo
-3
vvedite chislo
-4
vvedite chislo
-5

-1
-3
-5