Var A:array[1..5,1..5] of integer; i,j:integer; Begin WriteLn('Исходный массив:'); For i:= 1 to 5 do Begin For j:= 1 to 5 do Begin A[i,j]:=random(21)-10; Write(A[i,j]:3,' ') End; WriteLn End; WriteLn; WriteLn('Обработанный массив:'); For i:= 1 to 5 do Begin For j:= 1 to 5 do Begin if i=j then if A[i,j] < 0 then A[i,j]:=0; Write(A[i,j]:3,' ') End; WriteLn; End End.
A:array[1..5,1..5] of integer;
i,j:integer;
Begin
WriteLn('Исходный массив:');
For i:= 1 to 5 do
Begin
For j:= 1 to 5 do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
WriteLn;
WriteLn('Обработанный массив:');
For i:= 1 to 5 do
Begin
For j:= 1 to 5 do
Begin
if i=j then
if A[i,j] < 0 then A[i,j]:=0;
Write(A[i,j]:3,' ')
End;
WriteLn;
End
End.