Question

3. (20 pts) (Problem 2.25) The pseudocode in Fig. 1 computes the factorial. Express this algorithm as a well-structured function in either VBA or MATLAB. Test it by computing 0! and 5! In addition, test the error trap by trying to evaluate -2! Turn in your source code and show all the test results with screenshots.

Fig: 1

Fig: 2