Var A,B: array [1..10,1..10] of integer; i, j, n: integer; begin Randomize;writeln('Введите размерность n');readln(n);writeln('Матрица А'); for i:=1 to n do begin for j:=1 to n do begin A[i,j]:= random(10)+1;write(A[i,j]:3);end;writeln;end; writeln('Матрица B'); for i:=1 to n do begin for j:=1 to n do begin B[i,j]:= random(10)+2;write(B[i,j]:3);end;writeln;end; writeln('ответ: матрица AB'); for i:=1 to n do for j:=1 to n do begin C[i,j]:=(A[i,j]*B[i,j]);end;writeln; for i:=1 to n do begin for j:=1 to n do begin write(C[i,j]:3);end; writeln;end; writeln('ответ :матрица ВА'); for i:=1 to n do for j:=1 to n do begin D[i,j]:=(B[i,j]*A[i,j]);end; for i:=1 to n do begin for j:=1 to n do begin write(D[i,j]:3);end; writeln;end; end.
i, j, n: integer;
begin
Randomize;writeln('Введите размерность n');readln(n);writeln('Матрица А');
for i:=1 to n do begin
for j:=1 to n do begin
A[i,j]:= random(10)+1;write(A[i,j]:3);end;writeln;end;
writeln('Матрица B');
for i:=1 to n do begin
for j:=1 to n do begin
B[i,j]:= random(10)+2;write(B[i,j]:3);end;writeln;end;
writeln('ответ: матрица AB');
for i:=1 to n do
for j:=1 to n do begin C[i,j]:=(A[i,j]*B[i,j]);end;writeln;
for i:=1 to n do begin
for j:=1 to n do begin
write(C[i,j]:3);end; writeln;end;
writeln('ответ :матрица ВА');
for i:=1 to n do
for j:=1 to n do begin D[i,j]:=(B[i,j]*A[i,j]);end;
for i:=1 to n do begin
for j:=1 to n do begin
write(D[i,j]:3);end; writeln;end;
end.