function IsPositive(a:integer):boolean; begin result:=(a>-1); end;
procedure work; var min, max, count:integer; begin count:=0; min:=m[0]; max:=0; for i:=0 to 14 do begin if IsPositive(m[i]) then begin inc(count); if m[i]>max then max:=m[i]; if m[i]<min then min:=m[i]; end; end; writeln('MAX: ', max); writeln('MIN: ', min); writeln('Count: ', count); end;
begin for i:=0 to 14 do begin write('n: '); readln(m[i]); end;
var m:array [0..14] of integer; i:integer;
function IsPositive(a:integer):boolean;
begin
result:=(a>-1);
end;
procedure work;
var min, max, count:integer;
begin
count:=0;
min:=m[0];
max:=0;
for i:=0 to 14 do begin
if IsPositive(m[i]) then begin
inc(count);
if m[i]>max then max:=m[i];
if m[i]<min then min:=m[i];
end;
end;
writeln('MAX: ', max);
writeln('MIN: ', min);
writeln('Count: ', count);
end;
begin
for i:=0 to 14 do begin
write('n: ');
readln(m[i]);
end;
work;
readln;
end.
program Geom;
program Test_nn;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Math;
var
a: array of Extended;
n, i, c: Integer;
x: Extended;
begin
Write ('Размерность массива = ');
ReadLn (n);
SetLength (a, n);
Randomize;
for i := Low (a) to High (a) do begin
a [i] := (Random (2001) - 1000) / 1000;
Write (a [i] :7 :3);
end;
x := 1;
c := 1;
WriteLn;
for i := Low (a) to High (a) do begin
if a [i] > 0 then begin
Write (a [i] :7 :3);
x := x * a [i];
Inc (c);
end;
end;
WriteLn;
WriteLn ('Среднее геометрическое = ', Power (x, 1/c) :20 :15);
ReadLn;
end.