Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit question20_u;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Samples.Spin;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- SpinEdit1: TSpinEdit;
- Edit1: TEdit;
- Edit2: TEdit;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- iInput , K , iValue ,I , ISum: integer ;
- begin
- Isum:= 0;
- iInput := SpinEdit1.Value;
- iValue := 1;
- if iInput = 0 then
- ivalue := 0
- else
- for K := 1 to iInput do
- iValue := iVAlue * K ;
- edit1.Text:= inttostr(ivalue) ;
- for I := 1 to Length(inttostr(ivalue)) do
- begin
- iSum := iSum + ivalue[I};
- end;
- edit2.Text:= inttostr(isum);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement