uses graphABC;
begin
setwindowsize(600,500);
setbrushcolor(clGray);
Ellipse(320,30,490,400);
Ellipse(120,30,300,400);
setbrushcolor(clMintCream);
Ellipse(335,40,480,380);
Ellipse(140,40,280,380);
Ellipse(100,430,500,130);
setbrushcolor(clNavy);
Ellipse(250,240,200,310);
Ellipse(350,240,400,310);
setbrushcolor(clwhite);
Ellipse(240,270,220,300);
Ellipse(360,270,380,300);
setbrushcolor(clblack);
Ellipse(270,330,330,370);
line(300,370,300,400);
Arc(300,280,120,220,-40);
line(50,350,200,350);
line(30,340,190,340);
line(10,330,180,330);
line(410,330,570,330);
line(400,340,560,340);
line(390,350,550,350);
line(240,230,220,150);
line(230,230,180,80);
line(220,230,180,150);
line(360,230,380,150);
line(370,230,430,80);
line(380,230,430,150);
end.
1)
var
ar: array of integer;
n, min, max: integer;
write('Введите размер массива:');
read(n);
setlength(ar, n);
if (n > 0) then
ar[0] := random(-10, 10);
min := ar[0];
max := ar[0];
write(ar[0]:4);
end;
for var i := 1 to n - 1 do
ar[i] := random(-10, 10);
if (ar[i] < min) then min := ar[i]
else if (ar[i] > max) then max := ar[i];
write(ar[i]:4);
writeln(#13#10 + 'Среднее геометрическое модулей минимального и максимального значений = ',
sqrt(abs(max) * abs(min)):5:5);
2)
function minOrMax(ar: array of integer; size: integer; findMin: boolean): integer;
index: integer;
index := 0;
for var i := 1 to size - 1 do
if (findMin) and (ar[i] < ar[index]) then index := i
else if (not findMin) and (ar[i] > ar[index]) then index := i;
result := index;
3)
n: integer;
sqrt(abs(ar[minOrMax(ar, n, true)]) * abs(ar[minOrMax(ar, n, false)])):5:5);
uses graphABC;
begin
setwindowsize(600,500);
setbrushcolor(clGray);
Ellipse(320,30,490,400);
Ellipse(120,30,300,400);
setbrushcolor(clMintCream);
Ellipse(335,40,480,380);
Ellipse(140,40,280,380);
setbrushcolor(clGray);
Ellipse(100,430,500,130);
setbrushcolor(clNavy);
Ellipse(250,240,200,310);
Ellipse(350,240,400,310);
setbrushcolor(clwhite);
Ellipse(240,270,220,300);
Ellipse(360,270,380,300);
setbrushcolor(clblack);
Ellipse(270,330,330,370);
line(300,370,300,400);
Arc(300,280,120,220,-40);
line(50,350,200,350);
line(30,340,190,340);
line(10,330,180,330);
line(410,330,570,330);
line(400,340,560,340);
line(390,350,550,350);
line(240,230,220,150);
line(230,230,180,80);
line(220,230,180,150);
line(360,230,380,150);
line(370,230,430,80);
line(380,230,430,150);
end.
1)
var
ar: array of integer;
n, min, max: integer;
begin
write('Введите размер массива:');
read(n);
setlength(ar, n);
if (n > 0) then
begin
ar[0] := random(-10, 10);
min := ar[0];
max := ar[0];
write(ar[0]:4);
end;
for var i := 1 to n - 1 do
begin
ar[i] := random(-10, 10);
if (ar[i] < min) then min := ar[i]
else if (ar[i] > max) then max := ar[i];
write(ar[i]:4);
end;
writeln(#13#10 + 'Среднее геометрическое модулей минимального и максимального значений = ',
sqrt(abs(max) * abs(min)):5:5);
end.
2)
function minOrMax(ar: array of integer; size: integer; findMin: boolean): integer;
var
index: integer;
begin
index := 0;
for var i := 1 to size - 1 do
if (findMin) and (ar[i] < ar[index]) then index := i
else if (not findMin) and (ar[i] > ar[index]) then index := i;
result := index;
end;
3)
function minOrMax(ar: array of integer; size: integer; findMin: boolean): integer;
var
index: integer;
begin
index := 0;
for var i := 1 to size - 1 do
if (findMin) and (ar[i] < ar[index]) then index := i
else if (not findMin) and (ar[i] > ar[index]) then index := i;
result := index;
end;
var
ar: array of integer;
n: integer;
begin
write('Введите размер массива:');
read(n);
setlength(ar, n);
if (n > 0) then
begin
ar[0] := random(-10, 10);
write(ar[0]:4);
end;
for var i := 1 to n - 1 do
begin
ar[i] := random(-10, 10);
write(ar[i]:4);
end;
writeln(#13#10 + 'Среднее геометрическое модулей минимального и максимального значений = ',
sqrt(abs(ar[minOrMax(ar, n, true)]) * abs(ar[minOrMax(ar, n, false)])):5:5);
end.