uses crt;
var i,j,m:integer;
t:longint;
a:array[1..100,1..100]of integer;
begin
clrscr;
write('nhap m:');readln(m);
for i:=1 to m do
for j:=1 to m do
begin
write('a[',i,',',j,']=');readln(a[i,j]);
end;
clrscr;
writeln('ma tran da nhap la:');
for i:=1 to m do
begin
for j:=1 to m do
write(a[i,j]:5);writeln;
end;
i:=1;j:=1;
while i<=m do
begin
t:=t+a[i,j];
inc(i);inc(j);
end;
writeln('tong cac phan tu nam tren duong cheo chinh la: ',t);
readln;
end.