unit ujch;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    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
  n,i,p:integer;
begin
  n:=strtoint(Edit1.Text);
  i:=1;
  p:=1;
  if n>0 then
  begin
  while  i<=n do
    begin
    p:=p*i;
    i:=i+1;
    end;
   Label2.Caption:=inttostr(n)+'!='+inttostr(p);
   end
   else
   messageDlg('Êý¾ÝÎÞÐ§!',mtError,[MbOk],0);
   end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

end.
