Write a program in Pascal given integers a1 … an. If in this sequence no even number

Write a program in Pascal given integers a1 … an. If in this sequence no even number is located after the odd one, then get all negative members of the sequence otherwise positive.

program zz1;

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

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

k1: real;

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

begin

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

m [i]: = random (51) -25;

for i: = 1 to n do // display the resulting array on the screen

write (m [i], ”);

writeln; // go to a new line to display the response

for i: = 1 to n-1 do

begin

k: = m [i]; s: = m [i + 1];

if (s mod 2 = 0) and (k mod 2 = 1) then p: = 1;

end;

if p = 1

then for i: = 1 to n do if m [i]> 0 then write (m [i], ”)

else for i: = 1 to n do if m [i] <0 then write (m [i], ”); // 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.