unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    Calculate: TButton;
    procedure FormCreate(Sender: TObject);
    procedure CalculateClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  n:word;
  i:integer;
  x,rez:real;
implementation

{$R *.dfm}

procedure TForm1.CalculateClick(Sender: TObject);
begin
    n:=StrToInt(Edit1.Text);
    if n>=1 then begin
    x:=StrToFloat(Edit2.Text);
    rez:=0;
    for i:=1 to n do begin
      x:=sin(x);
      rez:=rez+x;
    end;
    Memo1.Clear;
    Memo1.Lines.Add(FloatToStr(rez)); end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo1.Clear;
end;

end.
