stepunit.~pas

来自「100以内阶乘计算(运用数组)」· ~PAS 代码 · 共 53 行

~PAS
53
字号
unit StepUnit;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    SpinEdit1: TSpinEdit;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var M:array [1..100]of integer;
i,j,jj,K,L,N:integer;
begin
for i:=1 to 99 do M[i]:=0;
M[100]:=1;
N:=SpinEdit1.Value;
for i:=1 to N do begin
L:=0;
for j:=1 to 100 do begin
jj:=101-j;
K:=i*M[jj]+L;
L:=K div 10;
M[jj]:=K mod 10;
 end;
end;
i:=1;
while M[i]=0 do i:=i+1;
Label1.caption:='';
for j:=i to 100 do
Label1.caption:=Label1.caption+inttostr(M[j]);

end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?