unit uSum;

interface

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

type
  TForm1 = class(TForm)
    PotenzEin: TEdit;
    Label1: TLabel;
    ErgebnisAus: TEdit;
    Label2: TLabel;
    Rechne: TButton;
    procedure RechneClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.RechneClick(Sender: TObject);
var k, n, pot, sum :integer;
begin
   n := strtoint(PotenzEin.text);
   pot := 1;
   sum := 1;
   for k :=1 to n do
     begin
       pot := 2*pot;
       sum := sum + pot;
     end;
   ErgebnisAus.Text := inttostr(sum);
end;

end.
