(* Teresa Tong F.4AS [30]   March,2002 *)
(* write a program with a procedure DisplayMonth to displays
   the name of the month by passing a number to it          *)

program Month;
uses wincrt;
var number, code:integer;
    M:string;

procedure DisplayMonth(code:integer;
                       var month:string);
begin
  case code of
  1: month:='January';
  2: month:='February';
  3: month:='March';
  4: month:='April';
  5: month:='May';
  6: month:='June';
  7: month:='July';
  8: month:='August';
  9: month:='September';
  10: month:='October';
  11: month:='November';
  12: month:='December';
  end;
end;


begin
  code:=0;
  writeln('Please enter a month number (1-12): ');
  readln(code);

  If (code<=12) and (code>0)
    then begin
         DisplayMonth(code, M);
         writeln('The month is ',M);
         end

    else begin
         repeat
         writeln('Please enter again (1-12): ');
         readln(code);
         until (code<=12) and (code>0);
         DisplayMonth(code, M);
         writeln('The month is ',M);
         end;

end.

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Output:
 
1) Please enter a month number (1-12):
   13
   Please enter again (1-12):
   10
   The month is October

2) Please enter a month number (1-12):
   8
   The month is August

    Source: geocities.com/ttt_7_ttt/home6

               ( geocities.com/ttt_7_ttt)