/* factorial.c Started by Jeff Ondich on 1/3/96 Last modified 4/1/97 This is the impementation of the one-function "factorial library." The interface is specified in factorial.h. */ #include "factorial.h" /* factorial() returns N! if N >= 0 and N <= MAX_N, and 0 otherwise. */ int factorial( int N ) { int i, product; if( N >= 0 && N <= MAX_N ) { product = 1; for( i=2; i <= N; i++ ) product = product * i; } else product = 0; return( product ); }