//8. Duota skaiÄių matrica n*n. Surikiuoti mažÄjanÄiai visas eilutes.
//Robertas Jurkaitis, 6 grupe
program matrica;
type mas = array [1..1000, 1..1000] of real;
procedure rikiuok(n:integer; var arr:mas);
var a, b, c:integer;
temp:real;
begin
for a:=1 to n do
begin
for b:=1 to n do
begin
for c:=1 to n do
begin
if (arr[a][c]>arr[b][c]) then
begin
//if c+1>n then break;
temp:=arr[a][c];
arr[a][c]:=arr[b][c];
arr[b][c]:=temp;
end;
end;
end;
end;
end;
//-------
var n, a, b, c:integer;
arr:mas;
begin
writeln('Duota skaiciu matrica n*n. Surikiuoti mazejanciai visas eilutes.');
writeln('Iveskite n: ');
readln(n);
randomize;
for a:=1 to n do
begin
writeln;
for b:=1 to n do
begin
arr[a][b]:=random(1000);
write(arr[a][b]:4:0, ' ');
end;
end;
writeln;
writeln;
writeln('Surusiavom');
rikiuok(n, arr);
for b:=1 to n do
begin
writeln;
for c:=1 to n do write(arr[b][c]:4:0, ' ');
end;
readln();
end.