const
N = 10;
var
a: array [1..N, 1..N] of integer;
i, j, iMin1, iMin2 : integer;
begin
randomize;
for i := 1 to N do
for j := 1 to N do
A[i][j] := random(100) - 50;
write(a[i][j], ' ');
end;
writeln;
iMin1 := 1;
iMin2 := 2;
for i := 3 to N do
if a[1][i] < a[1][iMin1] then
if a[1][iMin1] < a[1][iMin2] then
iMin2 := iMin1;
iMin1 := i;
end
else if a[1][i] < a[1][iMin2] then
iMin2 := i;
writeln(a[1][iMin1]);
writeln(a[1][iMin2]);
end.
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const
N = 10;
var
a: array [1..N, 1..N] of integer;
i, j, iMin1, iMin2 : integer;
begin
randomize;
for i := 1 to N do
begin
for j := 1 to N do
begin
A[i][j] := random(100) - 50;
write(a[i][j], ' ');
end;
writeln;
end;
iMin1 := 1;
iMin2 := 2;
for i := 3 to N do
begin
if a[1][i] < a[1][iMin1] then
begin
if a[1][iMin1] < a[1][iMin2] then
iMin2 := iMin1;
iMin1 := i;
end
else if a[1][i] < a[1][iMin2] then
iMin2 := i;
end;
writeln(a[1][iMin1]);
writeln(a[1][iMin2]);
end.