Uses GraphABC; procedure Draw(x, y, l, u : Real; t : Integer);
procedure Draw2(Var x, y: Real; l, u : Real; t : Integer); begin Draw(x, y, l, u, t); x := x + l*cos(u); y := y - l*sin(u);end; begin if t > 0 then beginl := l/3;Draw2(x, y, l, u, t-1);Draw2(x, y, l, u+pi/3, t-1); Draw2(x, y, l, u-pi/3, t-1);Draw2(x, y, l, u, t-1);end else Line(Round(x), Round(y), Round(x+cos(u)*l), Round(y-sin(u)*l))end; begin SetWindowSize(425,500); SetWindowCaption('Фракталы: Снежинка Коха'); Draw(10, 354, 400, pi/3, 4);Draw(410, 354, 400, pi, 4); Draw(210, 8, 400, -pi/3, 4);end.
var a: array[1..nmax] of integer; i, n, j, count: integer; mini, maxi: integer; min, max: real; temp: real; sum, product, harmonic: real; k: integer;
begin {ввод массива} n := nmax; if handsfree then n := random(nmax - 5) + 5 else begin write('n = '); readln(n); end;
writeln('Данные массива:'); for i := 1 to n do begin if handsfree then begin a[i] := random(random_max - random_min) + random_min; write(a[i], ' '); end else readln(a[i]); end; writeln();
{подсчет суммы и произведения и агригатов и кол-ва} sum := 0; product := 1; for i := 1 to n do begin sum := sum + a[i]; if a[i] mod 3 = 0 then {если нужен фильтр} product := product * a[i]; end; writeln('1) sum = ', sum); writeln('2) product = ', product);
{подсчет суммы и произведения и агригатов и кол-ва} sum := 0; count := 0; for i := 1 to n do begin if i mod 2 = 1 then {если нужен фильтр} begin count := count + 1; sum := sum + a[i]; end; end; writeln('3) average (selected) = ', sum / count);
{подсчет суммы и произведения и агригатов и кол-ва} sum := 0; product := 1; count := 0; for i := 1 to n do begin if i mod 2 = 0 then {если нужен фильтр} sum := sum + a[i]; if a[i] < 0 then {если нужен фильтр} product := product * a[i]; if a[i] mod 2 = 1 then {если нужен фильтр} count := count + 1; end; writeln('4) count = ', count); writeln('4) sum = ', sum); writeln('4) product = ', product); end.
Объяснение:
может быть скрыто . чекни в интернете как открыть другие тома