W
wdycwopt
Unregistered / Unconfirmed
GUEST, unregistred user!
function factorial(n:extended):extended;
begin
result:=1;
while n>1 do
begin
result:=result*n;
n:=n-1;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
num:extended;
begin
num:=strtoint(edit1.Text);
if num>20 then
showmessage('输入的数据不能大于20!')
else
edit2.Text:=inttostr(factorial(num));
end;
begin
result:=1;
while n>1 do
begin
result:=result*n;
n:=n-1;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
num:extended;
begin
num:=strtoint(edit1.Text);
if num>20 then
showmessage('输入的数据不能大于20!')
else
edit2.Text:=inttostr(factorial(num));
end;