program matrizon;
uses crt, windows;
type numerosale=array[1..4,1..4] of integer;
var lin,col,a,y,suma:integer;
posx, posy:integer;
x:numerosale;
begin
clrscr;
randomize;
for a:=2 to 3 do begin
for y:=2 to 3 do begin
x[a,y]:=random(11);
end;
end;
lin:=2;
col:=2;
for y:=2 to 3 do begin
suma:=suma+x[lin,col];
x[4,4]:=suma;
x[1,1]:=suma;
lin:=lin+1;
col:=col+1;
end;
lin:=3;
col:=2;
suma:=0;
for a:=2 to 3 do begin
suma:=suma+x[lin,col];
x[1,4]:=suma;
x[4,1]:=suma;
lin:=lin-1;
col:=col+1;
end;
posx:=10;
posy:=40;
for a:=1 to 4 do begin
posy:=37;
for y:=1 to 4 do begin
gotoxy(posy,posx);
if x[y,a]<1 then textcolor (12) else textcolor(white);
write(x[y,a]);
posy:=posy+3;
end;
posx:=posx+1;
end;
readkey;
end.