home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / pascal2c / fact.p < prev    next >
Text File  |  1992-08-03  |  326b  |  28 lines

  1.  
  2.  
  3. program factorials(input, output);
  4.  
  5.  
  6. var
  7.    i : integer;
  8.  
  9.  
  10.  
  11. function fact(n : integer) : integer;
  12.    begin
  13.       if n > 1 then
  14.          fact := n * fact(n-1)
  15.       else
  16.          fact := 1;
  17.    end;
  18.  
  19.  
  20.  
  21. begin
  22.    for i := 1 to 10 do
  23.       writeln('The factorial of ', i:1, ' is ', fact(i):1);
  24. end.
  25.  
  26.  
  27.  
  28.