// file: lecture_19/myfuncts_01.cc // // revision history: // // 20210302 (JP): refectored code // // local include files // #include "example.h" // function: fact // // arguments: // long n: the operand // // return: the factorial of n // // This function simply returns the factorial of the argument. // long fact(long n_a) { /* // compute the factorial using a loop // long value = n_a; while (n_a > 2) { n_a--; value *= n_a; } // exit gracefully // return value; */ // compute the factorial recursively // if (n_a <= 1) { return 1; } else { return n_a * fact(n_a - 1); } }