20 lines
523 B
Text
20 lines
523 B
Text
av: procedure options (main); /* 28 October 2013 */
|
|
declare x(10) fixed binary static initial (1, 4, 2, 6, 2, 5, 6, 2, 4, 2);
|
|
declare f(32767) fixed binary;
|
|
declare (j, n, max, value) fixed binary;
|
|
declare i fixed;
|
|
|
|
n = hbound(x,1);
|
|
|
|
do i = 1 to n;
|
|
j = x(i);
|
|
f(j) = f(j) + 1;
|
|
end;
|
|
max = 0;
|
|
do i = 1 to hbound(f,1);
|
|
if max < f(i) then do; max = f(i); value = i; end;
|
|
end;
|
|
put list ('The mode value is ' || value || ' occurred ' ||
|
|
max || ' times.');
|
|
|
|
end av;
|