===== PascalABC.NET =====
begin
var a := MatrRandom(5, 5, -99, 99);
a.Println;
Writeln;
var tMin := a.ElementsWithIndices.MinBy(p -> p[0]);
var tMax := a.ElementsWithIndices.MaxBy(p -> p[0]);
Swap(a[tMin[1], tMin[2]], a[tMax[1], tMax[2]]);
a.Println
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
===== PascalABC.NET =====
begin
var a := MatrRandom(5, 5, -99, 99);
a.Println;
Writeln;
var tMin := a.ElementsWithIndices.MinBy(p -> p[0]);
var tMax := a.ElementsWithIndices.MaxBy(p -> p[0]);
Swap(a[tMin[1], tMin[2]], a[tMax[1], tMax[2]]);
a.Println
end.