home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / awk / awk320.zip / FACT.AWK < prev    next >
Text File  |  1990-06-04  |  197b  |  12 lines

  1. # calculate and print the factorial of the input
  2.  
  3. function factorial(n) {
  4.     if (n <= 1)
  5.         return 1
  6.     else
  7.         return n * factorial(n - 1)
  8. }
  9. {
  10.     print $1, factorial($1)
  11. }
  12.