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.

This is coded in MATLAB. Exercise 2 a) The factorial of an

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!