uses crt; var e:array[1..3,1..7] of integer; s,max,n,m:integer;
index,sum:integer;
procedure max_el;
begin max:=e[1,1];
sum:=0;
index:=0;
for n:=1 to 3 do
begin
for m:=1 to 7 do
if e[n,m]>max then
max:=e[n,m];
index:=m;
end;
if e[n,index]<0 then
sum:=sum+e[n,index];
writeln('naibolwiy element = ',max,' summa otricatelnyh= ',sum);
clrscr;
writeln('elementy massiva');
writeln;
randomize;
for n:=1 to 3 do begin for m:=1 to 7 do
e[n,m]:=random(100) -50;
write('',e[n,m],' ');
max_el;
readkey;
end.
Объяснение:
uses crt; var e:array[1..3,1..7] of integer; s,max,n,m:integer;
index,sum:integer;
procedure max_el;
begin max:=e[1,1];
sum:=0;
index:=0;
for n:=1 to 3 do
begin
for m:=1 to 7 do
begin
if e[n,m]>max then
begin
max:=e[n,m];
index:=m;
end;
end;
end;
for n:=1 to 3 do
begin
if e[n,index]<0 then
begin
sum:=sum+e[n,index];
end;
end;
writeln('naibolwiy element = ',max,' summa otricatelnyh= ',sum);
end;
begin
clrscr;
writeln('elementy massiva');
writeln;
randomize;
for n:=1 to 3 do begin for m:=1 to 7 do
begin
e[n,m]:=random(100) -50;
write('',e[n,m],' ');
end;
writeln;
end;
writeln;
writeln;
max_el;
readkey;
end.
Объяснение: