Question: This is coded in MATLAB. Exercise 2 a) The factorial of an integer n is n! = 1 x 2 x 3 x... x n
This is coded in MATLAB.

Exercise 2 a) The factorial of an integer n is n! = 1 x 2 x 3 x... x n - 1) xn. Write a function myFactorial for(n) that calculates n! with a for loop. b) Write a function myFactorial_while(n) that calculates n! with a while loop. c) MATLAB has its built-in function to calculate a factorial. Find what it is and verify your two functions myFactorial for and myFactorial while by calculating n! for values of n from 1 to 9. This verification must be performed in a loop (of your choice) and use a logical operation to test the calculation is right for each value of n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
