Question: N should be an integer, not a fractional number (Hint: use rem() function which calculates remainder after division). How do I use the rem command

N should be an integer, not a fractional number (Hint: use rem() function which calculates remainder after division).
How do I use the rem command like the question hints at?
5 Compute factorial using loops (14 points) Write a M-file function script called calculateFactorial.m to evaluate the factorial function, which is defined as following: N!= N * (N 1)! if N >1 { if N=0 Where N is a positive integer passed as a function argument. The function takes the input value of N and returns the value of N!. The first line of the function should be: function output = calculateFactorial(N) Include following checks on the input and display an appropriate error message if the check is violated: N should be single number, not multi-valued array (Hint: use length() function) N should be non-negative N should be an integer, not a fractional number (Hint: use rem() function which calculates remainder after division) Once the input passes all the checks, evaluate the factorial value and store it in output. You may use for loop, while loop, and/or if-else statements. As your submission include the following: Complete M-file script. Evaluated function values for inputs N = 3, N =-2, N = [2 4], N = 10, N = 0.643
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
