Const n=10; m=3;
var
a:array[1..n,1..m] of integer;
i,j,s,k:integer; p:real;
begin
Randomize;
writeln('Исходный массив:');
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(81)+20;
write(a[i,j]:4);
end;
writeln;
end;
s:=0;
for i:=1 to n do
for j:=1 to m do s:=s+a[i,j];
p:=s/n*0.8;
writeln('p = ',p:5:2);
writeln('Зачислены:');
k:=0;
for i:=1 to n do
begin
s:=0;
for j:=1 to m do s:=s+a[i,j];
if s>=p then begin write(i,' '); k:=k+1; end;
end;
writeln;
writeln('k = ',k);
end.
Пример:
76 62 50
37 73 22
61 99 36
22 69 38
27 82 22
93 56 37
79 84 51
83 31 60
61 39 95
70 70 100
p = 142.80
Зачислены:
1 3 6 7 8 9 10
k = 7