An array of integers is given. Write a program that determines if an array contains a pair of adjacent elements

An array of integers is given. Write a program that determines if an array contains a pair of adjacent elements with the same sign. Specifications Input First, the number N is given – the number of elements in the array (1N10000). Then N numbers are written separated by a space – the elements of the array. The array consists of integers. Output It is necessary to output the word YES if there are a pair of adjacent elements with the same signs. Otherwise, output the word NO.

Let’s write a program in Pascal that determines whether the array contains a pair of adjacent elements with the same signs.
Given
Algorithm start:
const
n = 10000;
var
a: array [1..n] of integer;
i, n1, flag: integer;
begin
readln (n1);
for i: = 1 to n1 do
read (a [i]);
for i: = 1 to n1-1 do
if ((a [i] <0) and (a [i + 1] <0)) or
((a [i]> 0) and (a [i + 1]> 0)) then
flag: = 1;
if flag = 1 then
writeln (‘YES’)
else
writeln (‘NO’);
end.
Note: The construction ((a [i] <0) and (a [i + 1] <0)) or ((a [i]> 0) and (a [i + 1]> 0)) can be replaced with ( a [i] * a [i + 1])> 0



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.