Александр Устименко
Просветленный
(24316)
7 лет назад
var i, j, l, m: integer;
sum: real;
Q: array [1..100,1..100] of real;
A: array [1..100] of real;
begin
write ('l=');
readln(l);
write ('m=');
readln(m);
writeln ('ИСходная матрица');
for i:=1 to l do
begin
sum:=0;
for j:=1 to m do
begin
Q[i,j]:=-20+random(41);
write (Q[i,j]:7:2);
sum:=sum+Q[i,j];
end;
A[i]:=sum/m;
writeln (' ':5,'среднее арифметическое строки = ', sum/m:5:2)
end;
writeln ('Вновь сформированная матрица');
for i:=1 to l do
begin
sum:=0;
for j:=1 to m do
begin
Q[i,j]:=Q[i,j]-A[i];
write (Q[i,j]:7:2);
end;
writeln;
end;
end.
Program ex3;
const
nmax=100;
var
A:array [1..nmax,1..nmax] of real;
k,l,m,i,j:integer;
sr,sum:real;
begin
write('m = ');
readln(m);
write('l = ');
readln(l);
randomize;
writeln('Случайная матрица ', l, 'x', m, ':');
for i:=1 to l do
begin
sum:=0;
for j:=1 to m do
begin
a[i,j]:=random(10);
write(a[i,j]:4);
sum:=sum+a[i,j];
sr:=sum/m;
for k:=1 to m do
a[i,k]:=a[i,k]-sr;
end;
writeln (' a[i,k]=',a[i,k]);
end;
end.