program raf105;
const
n = 4;
var
a: array[1..n,1..n] of integer;
i,j,sum: integer;
begin
for i:=1 to n do
writeln;
for j:=1 to n do
a[i,j]:= random(1,9);
if i = j then
sum:= sum + a[i,j];
write(a[i,j]:4,' ');
end;
writeln('Вывод:');
if i <> j then
a[i,j]:= a[i,j] * sum;
end.
program raf105;
const
n = 4;
var
a: array[1..n,1..n] of integer;
i,j,sum: integer;
begin
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
a[i,j]:= random(1,9);
if i = j then
sum:= sum + a[i,j];
write(a[i,j]:4,' ');
end;
end;
writeln;
writeln;
writeln('Вывод:');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
if i <> j then
a[i,j]:= a[i,j] * sum;
write(a[i,j]:4,' ');
end;
end;
end.
PascalABC 3.4.2