A matrix of real numbers of size N by M is entered from the keyboard. N does not exceed 10, M does not exceed 20.
A matrix of real numbers of size N by M is entered from the keyboard. N does not exceed 10, M does not exceed 20. Find and display the number of the first row in which all elements are zero. If there are no elements satisfying the condition, display a corresponding message.
program zz1;
const n = 2;
m = 2; // set the number of elements in the array
var i, j, k, p: integer; // set variables of integer type
b: array [1..n, 1..m] of real;
begin
for i: = 1 to n do
for j: = 1 to m do // enter numbers into the array
read (b [i, j]);
for i: = 1 to n do
begin
for j: = 1 to m do
if b [i, j] = 0 then k: = k + 1;
if k = m then begin p: = i; break; end;
k: = 0;
end;
if p = 0 then write (‘there are no lines with all zeros’) // print the answer
else write (‘number of the first line with all zeros =’, i);
end.