Advertisement
cpt_cooke

zander Q20

Feb 10th, 2022
1,379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit question20_u;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Samples.Spin;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     SpinEdit1: TSpinEdit;
  13.     Edit1: TEdit;
  14.     Edit2: TEdit;
  15.     procedure Button1Click(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.dfm}
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. var
  31. iInput , K , iValue ,I , ISum: integer ;
  32. begin
  33. Isum:= 0;
  34.  iInput := SpinEdit1.Value;
  35.    iValue := 1;
  36.    if iInput = 0 then
  37.     ivalue := 0
  38.     else
  39.  for K := 1 to iInput do
  40.   iValue := iVAlue * K ;
  41.  
  42.   edit1.Text:= inttostr(ivalue) ;
  43.  
  44.  
  45.   for I := 1 to Length(inttostr(ivalue)) do
  46.     begin
  47.       iSum := iSum + ivalue[I};
  48.     end;
  49.  
  50.     edit2.Text:= inttostr(isum);
  51. end;
  52.  
  53. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement