帮我做计划
我必须找到矩阵 A [5, 4] 的每一列的正元素的算术平均值,前提是每一列中至少有一个正元素
我已经尝试过,但我无法理解错误
program double_array;
var
A : array [1..5, 1..4] of integer;
B : array [1..5] of real;
i, j, k : integer;
s : real;
begin
writeln('Enter your array');
for i := 1 to 5 do
begin
writeln(' ');
for j := 1 to 4 do
readln( A[i, j] );
end;
for i := 1 to 5 do
begin
s := 0; k := 0;
for j := 1 to 4 do
if A[i, j] > 1 then
begin
s := s + A[i,j];
k := k + 1;
end;
B[i] := s / k;
end;
writeln('Result B');
for i := 1 to 5 do
write ( B[i]:7:3 );
writeln;
end.
请帮帮我!