Answered step by step
Verified Expert Solution
Question
1 Approved Answer
THis is a matlab question. I need the code pleaser. 4. (25 points) Write a MatLab program that calculates and prints out the factorial of
THis is a matlab question. I need the code pleaser.
4. (25 points) Write a MatLab program that calculates and prints out the factorial of a number entered by the user (via an input O statement). The program must use a for loop to do the calculation and cannot use MatLab's built-in factorial) function The factorial of a number N, written as NI, is defined to be f N is 0 or 1 if N is a positive integer if N is negative or not an integer N! = N*(N-1) * .. . *3+2+1 undefined Note that your program will need to check for the special cases of N-0 or 1, N negative, or N not an integer, and produce an appropriate result or error message for each case. Hand in a printout showing your program's output for the factorial when each of the following numbers are entered as input: HINT: To see if a number is an integer or not, make use of MatLab's round () function, which rounds any number to the nearest integer, and compare that result with your original number This is a MATLAB problem. I need the code pleaseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started