Given an array. Check if it alternates between even and odd numbers. (Pascal)

program zz1;

const n = 6; // set the number of elements in the array

var i, s, k: integer; // set variables of integer type

m: array [1..n] of integer;

begin

for i: = 1 to n do // get n random numbers and write them into an array

read (m [i]);

for i: = 1 to n-1 do // check if the alternation is even and odd or odd and even, then we count

if ((m [i] mod 2 = 0) and (m [i + 1] mod 2 = 1)) or ((m [i] mod 2 = 1) and (m [i + 1] mod 2 = 0 )) then k: = k + 1;

if k = n-1 then writeln (‘alternating’) else writeln (‘not alternating’); // display the answer

end.



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.