You are given an array containing 2015 positive integers. Write a program in one of the programming

You are given an array containing 2015 positive integers. Write a program in one of the programming languages that finds in this array the number of local minima whose value is a multiple of 3. A local minimum is an array element that is smaller than all its neighbors. For example, in an array of 6 elements containing the numbers 4, 6,12, 7, 3, 8, there are two local minima: these are elements equal to 4 and 3. The program should display the total number of matching elements, you do not need to display the values of the elements.

program zz1;
const n = 2015; // set the number of numbers 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
m [i]: = random (51);
for i: = 2 to n – 1 do // organize a loop in which we iterate over all the numbers in the array
begin
if (m [i] <m [i + 1]) and (m [i] <m [i – 1]) then
if m [i] mod 3 = 0 then s: = s + 1; // check if the next element of the array is a local minimum, then check it for multiples of three, if multiple, then count
end;
writeln (‘the number of local minimums is multiples of three =’, s); // 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.