На паскале АБЦ
const n=3;
var m:array[1..n,1..n] of real; s1,s2:real; i,j:integer;
begin
for j:=1 to n do
for i:=1 to n do read(m[i,j]);
s1:=0;
for i:=1 to n do s1:=s1+m[i,i];
s2:=0;
for j:=1 to n do
for i:=j+1 to n do s2:=s2+m[i,j];
writeln(s1,' ',s2)
end.