Исправить код так, что бы массив а, заполнялся рандомно. var a: array[1..100,1..100] of integer; c: array[1..20,1..20] of real; b: array[1..20,1..20] of real; i,j,n,k: integer; t: real; r: integer; begin t: =0; writeln('введите порядок матрицы: '); readln(n); for i: =1 to n do for j: =1 to n do begin write('a[',i,',',j,']='); readln(a[i,j]); end; for i: =1 to n do for j: =1 to n do begin b[i,j]: =1/i+j-1; end; for i: =1 to n do for j: =1 to n do begin for k: =1 to n do begin t : =t+a[i,k]*b[k, j]; end; c[i,j]: =t; t: =0; end; for i: =1 to n do begin for j: =1 to n do begin write(' ',c[i,j]: 2: 2); end; writeln; end; end.
a:array[1..100,1..100] of integer;
c:array[1..20,1..20] of real;
b:array[1..20,1..20] of real;
i,j,n,k:integer;
t:real;
r:integer;
begin
randomize;
t:=0;
Writeln('Введите порядок матрицы: ');
readln(n);
for i:=1 to n do
for j:=1 to n do
begin
a[i, j] := random(10);
end;
for i:=1 to n do
for j:=1 to n do
begin
b[i,j]:=1/i+j-1;
end;
for i:=1 to n do
for j:=1 to n do
begin
for k:=1 to n do
begin
t :=t+a[i,k]*b[k, j];
end;
c[i,j]:=t;
t:=0;
end;
for i:=1 to n do
begin
for j:=1 to n do
begin
write(' ',c[i,j]:2:2);
end;
Writeln;
end;
end.
for i:=1 to n do
for j:=1 to n do
begin
Write('a[',i,',',j,']=');
Readln(a[i,j]);
end;
делаем так :
for i:=1 to n do
for j:=1 to n do
begin
a[i,j]:=random (100);
end;