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.
begin
var a:=ArrRandom(100,-10,10);
a.Println;
Writeln(a.Where(x->x>0).Count,' положительных, ',
a.Where(x->x<0).Count,' отрицательных')
end.
Тестовое решение:
4 -6 0 8 2 -2 -1 -8 -6 8 -3 7 4 -7 -5 9 0 -3 -7 1 0 -4 6 3 8 -10 4 9 3 5 8 5 5 8 10 4 -8 3 8 8 -9 2 7 -8 -7 -5 2 -9 0 9 -7 7 -2 -6 7 -2 -1 7 -10 2 4 1 -1 0 10 3 -8 6 -6 2 6 7 -1 -4 -1 8 0 3 0 2 -2 2 -1 5 1 -9 -4 1 -9 1 -6 -5 3 -4 -7 1 -7 -3 -7 1
51 положительных, 42 отрицательных