unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
 r:array of integer;
 i:Integer;
begin
 ListBox1.Items.Clear;
 SetLength(r,10);

 for i:=0 to High(r) do
  begin
   r[i]:=i*i;
   ListBox1.Items.Add(IntToStr(i)+' в квадрате ='+IntToStr(r[i]));
  end; 
end;

procedure TForm1.Button2Click(Sender: TObject);
type
 TDynArr=array of integer;
var
 r:TDynArr;
 i:Integer;
begin
 ListBox1.Items.Clear;
 SetLength(r,10);

 for i:=0 to High(r) do
  r[i]:=i*i;

 SetLength(r,20);
 for i:=10 to High(r) do
  r[i]:=i*i;

 for i:=0 to High(r) do
  ListBox1.Items.Add(IntToStr(i)+' в квадрате ='+IntToStr(r[i]));
end;

end.
