program matrica; uses CRT; const a = 50; var i, j, suma_stroki, ind, max_suma, temp, n : integer; M : array[1..a, 1..a] of integer; begin max_suma := 0; writeln('Is skolki strok sostoit matrica: '); readln(n); for i:=1 to n do begin writeln('Vvedite elementy ', i, ' stroki: '); for j := 1 to n do read(M[i, j]); end; for i := 1 to n do begin suma_stroki := 0; for j := 1 to n do suma_stroki := suma_stroki + M[i, j]; if suma_stroki > max_suma then begin max_suma := suma_stroki; ind := i; end; end; for j := 1 to n do begin temp := M[j, ind]; M[j, ind] := M[ind, j]; M[ind, j] := temp; end; clrscr; writeln('Novaja matrica: '); for i := 1 to n do begin for j :=1 to n do write(M[i, j] :5); writeln; end; readln; end. |