unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Button1: TButton;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var tab2: array of array of integer;
  s, i,j,w,k:integer;

begin
  Randomize;
  w:=StrToInt(Edit1.Text);//lub StrToIntDef
  k:=StrToInt(Edit2.Text);//lub StrToIntDef
  SetLength(tab2,w,k);
  for i:=0 to w-1 do
    for j:=0 to k-1 do
    begin
      tab2[i,j]:=Random(2);
      s:=s+tab2[i,j];
    end;
  label1.Caption:='Liczba jedynek='+IntToStr(s)+'  Liczba zer='+IntToStr(w*k-s);
end;

end.
