Var m : array[1..4,1..4] of Integer; m_new : array[1..4] of Integer; i,j : Integer; Begin For i:=1 to 4 do Begin For j:=1 to 4 do Begin m[i,j]:=Random(100); Write(m[i,j]:5); If i=j then m_new[i]:=m[i,j]; end; Writeln; end; Writeln('Главная диагнональ: '); For i:=1 to 4 do Write(m_new[i]:5); Writeln; end.
m : array[1..4,1..4] of Integer;
m_new : array[1..4] of Integer;
i,j : Integer;
Begin
For i:=1 to 4 do
Begin
For j:=1 to 4 do
Begin
m[i,j]:=Random(100);
Write(m[i,j]:5);
If i=j then m_new[i]:=m[i,j];
end;
Writeln;
end;
Writeln('Главная диагнональ: ');
For i:=1 to 4 do Write(m_new[i]:5);
Writeln;
end.