program money;

(* This program takes any given amount of money (in pence) and converts it
   into the relevent number of œ10, œ5, œ1, 50p, 20p, 10p, 5p, 2p and 1p
   notes/coins *)

type NOTE_COIN = (note10, note5,
                  coin100, coin50, coin20, coin10, coin5, coin2, coin1);

var Pence, Number: ARRAY[note10..coin1] of INTEGER;
    Money: INTEGER;
    Denomination: NOTE_COIN;

procedure Initialise_Array;
begin
  Pence[note10]:=1000; Pence[note5] :=500; Pence[coin100]:=100;
  Pence[coin50]:=  50; Pence[coin20]:= 20; Pence[coin10] := 10;
  Pence[coin5] :=   5; Pence[coin2] :=  2; Pence[coin1]  :=  1;
end;

procedure List_Denominations;
begin
  WriteLn ('10 pounds: ',Number[note10]);
  WriteLn (' 5 pounds: ',Number[note5]);
  WriteLn (' 1 pounds: ',Number[coin100]);
  WriteLn ('50 pences: ',Number[coin50]);
  WriteLn ('20 pences: ',Number[coin20]);
  WriteLn ('10 pences: ',Number[coin10]);
  WriteLn (' 5 pences: ',Number[coin5]);
  WriteLn (' 2 pences: ',Number[coin2]);
  WriteLn (' 1 pences: ',Number[coin1]);
end;

begin (* main *)
  Initialise_Array;
  ClrScr; Write ('Enter money (in pence): '); ReadLn (Money);
  for Denomination:=note10 to coin1 do
  begin
    Number[Denomination]:=Money DIV Pence[Denomination];
    Money:=Money MOD Pence[Denomination];
  end;
  List_Denominations;
end. (* main *)