Programs to Debug: Number 9

We suggest that you inspect this program to see if you can spot the error before attempting to compile it in Delphi or Lazarus. Make the necessary changes so that each program will compile and achieve the stated purpose. Our pages on common programming errors may help you.

program PowersOfTwo;
{$APPTYPE CONSOLE}
{This program should output the powers of 2 from
 2^1 to 2^32.  There is one deliberate error.}
uses
  SysUtils;
var
  PowerOfTwo, Exponent : integer;
begin
  PowerOfTwo := 2;
  for Exponent := 1 to 32 do
    begin
      writeln('2^', Exponent,' = ', PowerOfTwo);
      PowerOfTwo := PowerOfTwo * 2;
    end;
  readln;
end.
Programming - a skill for life!

Spot the deliberate errors