unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    edt1: TEdit;
    edt2: TEdit;
    edt3: TEdit;
    edt4: TEdit;
    lbl1: TLabel;
    lbl2: TLabel;
    lbl3: TLabel;
    lbl4: TLabel;
    lbl5: TLabel;
    mmo1: TMemo;
    btn1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
edt1.Text:='0,1';
 edt2.Text:='0,7';
  edt3.Text:='0,25';
   edt4.Text:='0,0001';
end;

procedure TForm1.btn1Click(Sender: TObject);
 var Xn, Xf, e, S, h, y, a:Extended;
      N, k:Integer;
begin
mmo1.Clear;
mmo1.Lines.Add('Start Data:');
Xn:=StrToFloat(edt1.Text);
    mmo1.Lines.Add('Xn='+FloatToStrF(Xn,ffFixed,6,5));
Xf:=StrToFloat(edt2.Text);
    mmo1.Lines.Add('Xf='+FloatToStrF(Xf,ffFixed,6,5));
h:=StrToFloat(edt3.Text);
    mmo1.Lines.Add('h='+FloatToStrF(h,ffFixed,6,5));
e:=StrToFloat(edt4.Text);
    mmo1.Lines.Add(' e='+FloatToStrF(e,ffFixed,6,5));
       n:=0;
       S:=1;
       y:=0;
       a:=1;
      mmo1.Lines.Add('If N=0, S1='+IntToStr(N));
  while (Xn<Xf)and(S>e) do begin
  N:=N+1;
  a:=a*2*xn/n;
  S:=S*a;
    mmo1.Lines.Add('If N='+inttoStr(N)+'; S='+FloatToStrf(S,ffFixed,6,5)+'; y='+FloatToStrf(S,ffFixed,6,5)+'; X='+FloatToStrf(Xn,ffFixed,6,5));
  y:=Power(Exp(xn),2);
    Xn:=Xn+h;
end;
   mmo1.Lines.Add('s='+FloatToStrF(S,fffixed,6,6));
 end;
end.
