Var
a: Array[1..30,1..30] of Integer;
n,min, max, i,j,s: Integer;
BEGIN
writeln('n=');
readln(n);
Randomize;
Writeln('sluciayniy massiv:');
For i:=1 to n do
begin
For j:=1 to n do begin
a[i,j]:=Random(51)-25;
Write(a[i,j]:5);
end;
Writeln;
end;
s:=0;
min:= a[1,1];
max:= a[1,1];
for i:= 1 to n do
for j:= 1 to n do
if a[i,j] min := a[i,j];
for i:= 1 to n do
for j:= 1 to n do
if a[i,j]> max then
max:= a [i,j];
for i:=1 to n do
for j:= 1 to n do
if i=j then
s:= s+a[i,j];
writeln('min=',min, ' max=',max,' summa elementov glavnoi dioganali=',s);
readln;
end.
________________________________
Var
a: Array[1..100,1..100] of Integer;
n,min, max, i,j,s:Integer;
BEGIN
writeln('n=');
readln(n);
Writeln('vvedite massiv:');
For i:=1 to n do
begin
For j:=1 to n do
begin
read(a[i,j]);
end;
Writeln;
end;
s:=0;
min:= a[1,1];
max:= a[1,1];
for i:= 1 to n do
for j:= 1 to n do
if a[i,j] for i:= 1 to n do
for j:= 1 to n do
if a[i,j]> max then max:= a [i,j]; {поиск максимального элемента}
for i:=1 to n do
for j:= 1 to n do
if i=j then s:= s+a[i,j]; { поиск элементов главной диагонали и нахождение их суммы}
writeln('min=',min, ' max=',max,' summa elementov glavnoi dioganali=',s);
readln;
end.