View difference between Paste ID: SsVfA4cG and ZNmFzd5B
SHOW: | | - or go back to the newest paste.
1
const
2
  Xcap = 8;
3
  Ycap = 8;
4
5
type
6
  data = array[1..Xcap, 1..Ycap] of integer;
7
8
var
9
  A: data;
10
11
function max_column(d: data): integer;
12
var
13
  sum, i, j, col, top: integer;
14
begin
15
  for i := 1 to Xcap do 
16
  begin
17
    sum := 0;
18
    for j := 1 to Ycap do
19
    begin
20
      sum := sum + A[i, j];
21
    end;
22
    
23
    if (sum > top) then 
24
    begin
25
      top := sum;
26
      col := i;
27
    end;
28
  end;
29
  max_column := col;
30
end;
31
32
begin
33-
  randomize;
33+
34
  for i := 1 to Xcap do 
35
  begin
36
    for j := 1 to Ycap do
37
      readln(A[i, j]);
38-
      A[i, j] := random(100);
38+
39
  
40
  writeln(max_column(A));
41
end.