#!/usr/bin/bc /* Factorial * * This file defines the function fac(n). * Run the program, then type fac(42) (for example) * You can calculate as many factorials as you like. When you've finished, type quit. * * (c) 2019 D. Haworth */ define fac(n) { f = 1 while ( n > 1 ) { f = f * n n = n - 1 } return (f) }