Given a one-dimensional array of numbers. Find the number of array elements exceeding the given number

Given a one-dimensional array of numbers. Find the number of array elements exceeding the given number A in absolute value, change the sign of the maximum element to the opposite, find the number of array elements that are multiples of 5.

program zz1;

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

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

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

begin

write (‘enter the given number a’);

read (a);

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

m [i]: = random (21) -10;

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 do

if abs (m [i])> a then k: = k + 1;

writeln (‘the number of array elements exceeding in absolute value the given number A =’, k); // display the answer

max1: = 0;

for i: = 1 to n do // find the maximum element and its number

if m [i]> max1 then begin max1: = m [i]; k: = i; end;

m [k]: = m [k] * – 1; // change sign

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

k: = 0;

for i: = 1 to n do

if m [i] mod 5 = 0 then k: = k + 1;

writeln (‘the number of array elements, multiples of 5 =’, k); // 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.