Program n1; const n=15; var a: array [1..n] of integer; i,sum,k: integer; begin randomize; sum:=0; writeln('массив: '); for i:=1 to n do begin a[i]:=random(20); write(a[i],' '); end; for i:=1 to n do if a[i]<>0 then begin sum:=sum+a[i]; k:=k+1; end; writeln; writeln('ср. арифм: ',sum/k); end.
const n=15;
var a: array [1..n] of integer;
i,sum,k: integer;
begin
randomize;
sum:=0;
writeln('массив: ');
for i:=1 to n do
begin
a[i]:=random(20);
write(a[i],' ');
end;
for i:=1 to n do if a[i]<>0 then
begin
sum:=sum+a[i];
k:=k+1;
end;
writeln;
writeln('ср. арифм: ',sum/k);
end.