var arr: array[1..N, 1..M] of Integer; i, j: Integer; flag: Boolean;
begin Randomize;
// Fill the array with random positive numbers for i := 1 to N do begin for j := 1 to M do begin arr[i, j] := Random(20) + 1; end; end;
// Output the array writeln('Array:'); for i := 1 to N do begin for j := 1 to M do begin write(arr[i, j], ' '); end; writeln; end;
// Find and output the row numbers with only positive elements writeln('Rows with only positive elements:'); for i := 1 to N do begin flag := True; for j := 1 to M do begin if arr[i, j] <= 0 then begin flag := False; break; end; end; if flag then begin writeln('Row ', i); end; end;
program PositiveNumbers;
const
N = 5;
M = 3;
var
arr: array[1..N, 1..M] of Integer;
i, j: Integer;
flag: Boolean;
begin
Randomize;
// Fill the array with random positive numbers
for i := 1 to N do
begin
for j := 1 to M do
begin
arr[i, j] := Random(20) + 1;
end;
end;
// Output the array
writeln('Array:');
for i := 1 to N do
begin
for j := 1 to M do
begin
write(arr[i, j], ' ');
end;
writeln;
end;
// Find and output the row numbers with only positive elements
writeln('Rows with only positive elements:');
for i := 1 to N do
begin
flag := True;
for j := 1 to M do
begin
if arr[i, j] <= 0 then
begin
flag := False;
break;
end;
end;
if flag then
begin
writeln('Row ', i);
end;
end;
end.