Program pr2; uses crt; var m,n,i,j,k,l:integer; mas: array[1..99,1..99] of integer; masb: array [1..99] of integer; begin clrscr; write('vvedite m'); readln(m); write('vvedite n'); readln(n); writeln('vvedite massiv MxN') ;for i:=1 to m do for j:=1 to n do begin write('mas[',i,',',j,']= '); readln(mas[i,j]); end; for i:=1 to m do begin k:=mas[i,1]; l:=mas[i,1]; for j:=1 to n do begin if k < mas[i,j] then k:=mas[i,j]; if l > mas[i,j] then l:=mas[i,j]; end; masb[i]:=k-l;
end; for i:=1 to m do begin for j:=1 to n do write(mas[i,j],' '); writeln('result = ',masb[i]); end; readln(i) end.
Var a: array[1..10] of integer; b: array[1..10] of real; i,n: integer; s: real; begin s:=0; n:=0; write('массив a: '); for i:=1 to 10 do begin read(a[i]); if a[i]<0 then begin s:=s+a[i]; n:=n+1; end; write(a[i],' '); end; s:=s/n; writeln; writeln('среднее арифметическое отрицательных: ',s); writeln('количество отрицательных: ',n); write('массив b: '); for i:=1 to 10 do begin if a[i]<0 then b[i]:=s else b[i]:=a[i]; write(b[i]:7:3); end; end.
uses crt;
var
m,n,i,j,k,l:integer;
mas: array[1..99,1..99] of integer;
masb: array [1..99] of integer;
begin
clrscr;
write('vvedite m');
readln(m);
write('vvedite n');
readln(n);
writeln('vvedite massiv MxN')
;for i:=1 to m do
for j:=1 to n do
begin
write('mas[',i,',',j,']= ');
readln(mas[i,j]);
end;
for i:=1 to m do
begin
k:=mas[i,1];
l:=mas[i,1];
for j:=1 to n do
begin
if k < mas[i,j] then k:=mas[i,j];
if l > mas[i,j] then l:=mas[i,j];
end;
masb[i]:=k-l;
end;
for i:=1 to m do
begin
for j:=1 to n do
write(mas[i,j],' ');
writeln('result = ',masb[i]);
end;
readln(i)
end.
b: array[1..10] of real;
i,n: integer;
s: real;
begin
s:=0; n:=0;
write('массив a: ');
for i:=1 to 10 do
begin
read(a[i]);
if a[i]<0 then
begin
s:=s+a[i];
n:=n+1;
end;
write(a[i],' ');
end;
s:=s/n;
writeln;
writeln('среднее арифметическое отрицательных: ',s);
writeln('количество отрицательных: ',n);
write('массив b: ');
for i:=1 to 10 do
begin
if a[i]<0 then b[i]:=s
else b[i]:=a[i];
write(b[i]:7:3);
end;
end.
массив a: 2 2 -3 1 -5 -6 -5 9 -7 5
среднее арифметическое отрицательных: -5.2
количество отрицательных: 5
массив b: 2.000 2.000 -5.200 1.000 -5.200 -5.200 -5.200 9.000 -5.200 5.000