Const n=4; m=5;
var a:array[1..n,1..m] of integer;
s,i,j:integer;
begin
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(50);
write(a[i,j]:3);
end;
writeln;
end;
for j:=1 to m do
begin
s:=0;
for i:=1 to n do s:=s+a[i,j];
writeln(j,': ',s);
end;
end.
Пример:
44 17 31 46 5 23 24 27 32 24
9 34 41 27 16
46 27 10 36 0
1: 122
2: 102
3: 109
4: 141
5: 45