Первая программа:
Const
N = 3;
Var
A:array[1..N,1..N] of integer;
i,j:integer;
Begin
Randomize;
WriteLn('Исходная матрица:');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ');
End;
WriteLn
End;
WriteLn('Новая матрица:');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
if A[i,j] < 0 then A[i,j]:=A[i,j] -5
else if A[i,j] > 0 then A[i,j]:=A[i,j] +5;
Write(A[i,j]:3,' ');
End;
WriteLn
End;
End.
Вторая программа:
Const
N = 3;
Var
A:array[1..N,1..N] of integer;
i,j:integer;
Begin
Randomize;
WriteLn('Исходная матрица:');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ');
End;
WriteLn
End;
WriteLn('Новая матрица:');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
if j>i then A[i,j]:=1
else if j Write(A[i,j]:3,' ');
End;
WriteLn
End;
End.