Question: Please do the following Matlab problem, 1.Write a for loop ranging from 3 to 5. In the loop, print the value of the loop index

Please do the following Matlab problem,

1.Write a for loop ranging from 3 to 5. In the loop, print the value of the loop index to the screen using fprintf in the following format:

                          Value is n

              where n is not the letter “n,” but is the value of the associated loop index.

2.Write a while loop that produces the same result as problem 1. You’ll need to initialize an index, and then increment it within the loop.

3.Write a function with one input and no outputs. The input will be an integer. The resulting value which will print to the screen will be the product of all integers from 2 through the input value, which is the factorial of the number. After the loop, also calculate the factorial of the number using the built-in MATLAB function factorial . Print the value of the factorial calculated in the loop and the value from the MATLAB function to the screen. Test the function using the input value 10, which should result in an answer of 3,628,800.

Step by Step Solution

3.37 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets tackle the given MATLAB problem step by step St... View full answer

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 Programming Questions!