program Project1;
{$APPTYPE CONSOLE}
Var
x, y: byte;
mas: array [1 .. 4, 1 .. 4] of integer;
sum: integer;
begin
sum := 0;
Randomize;
For x := 1 to 4 do
For y := 1 to 4 do
mas[x, y] := Random(10);
For x := 1 to 4 do
begin
For y := 1 to 4 do
Write(mas[x, y], ' ');
Writeln;
End;
Writeln;
{ Сумма столбцов }
For x := 1 to 4 do
begin
For y := 1 to 4 do
sum := sum + mas[x, y];
Writeln(sum);
sum := 0;
End;
Writeln;
{ Сумма строк }
For x := 1 to 4 do
begin
For y := 1 to 4 do
sum := sum + mas[y, x];
Writeln(sum);
sum := 0;
End;
Readln;
end.