home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / dbug.lzh / DBUG / FACTORIAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-16  |  359 b   |  16 lines

  1. #include <stdio.h>
  2. /* User programs should use <local/dbug.h> */
  3. #include "dbug.h"
  4.  
  5. int factorial (value)
  6. register int value;
  7. {
  8.     DBUG_ENTER ("factorial");
  9.     DBUG_PRINT ("find", ("find %d factorial", value));
  10.     if (value > 1) {
  11.         value *= factorial (value - 1);
  12.     }
  13.     DBUG_PRINT ("result", ("result is %d", value));
  14.     DBUG_RETURN (value);
  15. }
  16.