Вот я поправил
program p1;
uses crt;
var a:array[1..10,1..10] of integer;
i,j,n,max,min,s:integer;
begin
read(N);
for i:=1 to N do begin
For j:=1 to N do begin
a[i,j]:=random (101) ;
write(a[i,j]:5);
end;
writeln;
end;
max:=a[1,1];
min:=a[1,1];
for i:=1 to N do begin
If max max:=a[i,i];
end;
If min>a[i,i] then begin
min:=a[i,i];
end;
end;
s:=max+min;
writeln;
write(s);
end.