program CheckAlternatingNumbers(arr: array of Integer): Boolean; var i: Integer; begin for i := 0 to Length(arr) - 2 do begin if (arr[i] mod 2 = 0) and (arr[i + 1] mod 2 = 0) then begin CheckAlternatingNumbers := False; Exit; end else if (arr[i] mod 2 <> 0) and (arr[i + 1] mod 2 <> 0) then begin CheckAlternatingNumbers := False; Exit; end; end;
program CheckAlternatingNumbers(arr: array of Integer): Boolean;
var
i: Integer;
begin
for i := 0 to Length(arr) - 2 do
begin
if (arr[i] mod 2 = 0) and (arr[i + 1] mod 2 = 0) then
begin
CheckAlternatingNumbers := False;
Exit;
end
else if (arr[i] mod 2 <> 0) and (arr[i + 1] mod 2 <> 0) then
begin
CheckAlternatingNumbers := False;
Exit;
end;
end;
CheckAlternatingNumbers := True;
end;