Найти среднее арифметическое произведений элементов каждой строки матрицы — Pascal(Паскаль)

program PascalGuru;

uses crt;

var
  A: array [1 .. 50, 1 .. 50] of integer;
  B: array [1 .. 50] of integer;
  i, j, n, pr: integer;
  sr: real;

  { ---------------------------------------------------- }
begin
  write('Razmer matritsy= ');
  readln(n);

  for i := 1 to n do
    for j := 1 to n do
    begin
      write('A[', i, ',', j, ']= ');
      readln(A[i, j]);
    end;

  clrscr;
  write('Matritsa:');
  for i := 1 to n do
  begin
    writeln;
    for j := 1 to n do
      write(A[i, j]:8);
  end;
  writeln;
  writeln;

  for i := 1 to n do
  begin
    pr := 1;
    for j := 1 to n do
      pr := pr * A[i, j];
    B[i] := pr;
  end;

  sr := 0;
  for i := 1 to n do
    sr := sr + B[i];
  sr := sr / n;
  writeln('Sr.Ar: ', sr);
  readln;

end.

Leave a Comment