Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A factorial is the product of all positive integers less than or equal to a given positive number. Write a function that will receive as

A factorial is the product of all positive integers less than or equal to a given positive number. Write a function that will receive as input either a single positive number or a vector of positive numbers and return the factorials as a vector.

For example, if 5! is passed to the function, the returned value would be 120 (1*2*3*4*5). Likewise, if a vector [6 4 2 1] is passed, the function will return a vector with the factorial of every element in the input vector. Make sure you use a for loop in your solution.

function output = fact2prod(n)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

7. How can the models we use have a detrimental effect on others?

Answered: 1 week ago