The values of the elements of a two-dimensional array A of 5×5 size are set using a nested loop in the presented
The values of the elements of a two-dimensional array A of 5×5 size are set using a nested loop in the presented program fragment: Pascal Algorithmic language for i: = 1 to 5 do for j: = 1 to 5 do begin A [i, j]: = i + j; end; Write a program fragment that will allow you to find how many elements of an array will have values greater than 5?
For the sake of clarity, operators for outputting the array are inserted into the fragment line by line.
program arr;
var a: array [1..5,1..5] of integer;
i, j, n: integer;
begin for i: = 1 to 5 do for j: = 1 to 5 do
begin A [i, j]: = i + j;
write (a [i, j], ”);
if j = 5 then writeln (); // break into lines
if a [i, j]> 5 then n: = n + 1; // the fragment in which it is considered
// number of elements
end;
writeln (‘Number of items with a value greater than 5 -‘, n)
end.