Добавь модуль Math, создай на форме Label и после implementation {$R *.dfm} вставь procedure TForm1.FormCreate(Sender: TObject); const n=10; var a:array[1..n] of integer; i,mi,ma,s:integer; begin randomize; s:=0; ma:=1; mi:=1; for i:=1 to n do begin a[i]:=random(20)-10; if a[i]>a[ma] then ma:=i else if a[i]<a[mi] then mi:=i; label1.caption:=label1.caption + inttostr(a[i]) + ' '; end; for i:=min(ma,mi) to max(ma,mi) do s:=s+a[i]; label1.caption:=label1.caption + #13 + inttostr(s); end;
procedure TForm1.FormCreate(Sender: TObject);
const n=10;
var a:array[1..n] of integer;
i,mi,ma,s:integer;
begin
randomize;
s:=0;
ma:=1;
mi:=1;
for i:=1 to n do begin
a[i]:=random(20)-10;
if a[i]>a[ma] then ma:=i
else if a[i]<a[mi] then mi:=i;
label1.caption:=label1.caption + inttostr(a[i]) + ' ';
end;
for i:=min(ma,mi) to max(ma,mi) do s:=s+a[i];
label1.caption:=label1.caption + #13 + inttostr(s);
end;