Question

Use MATLAB: Use a conditional while loop to find the first factorial that is greater than...

Use MATLAB:

Use a conditional while loop to find the first factorial that is greater than the input argument high. (high=5000)

Please provide matlab code.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
function result = getLargeFactorial(high)
    i = 2;
    result = 1;
    while(result<high)
        result=result*i;
        i=i+1;
    end
end

Add a comment
Know the answer?
Add Answer to:
Use MATLAB: Use a conditional while loop to find the first factorial that is greater than...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This basic problem demonstrates the while-loop. (USE MATLAB) Write a Matlab function called steps that takes one scalar...

    This basic problem demonstrates the while-loop. (USE MATLAB) Write a Matlab function called steps that takes one scalar as an input argument and returns two scalars as output arguments. If it is called this way [n, d_left] = steps(d), then it sets n equal to the minimum number of steps required to move from a distance of one foot away from a wall to a distance less than d feet from the wall. The first step is 1/2 foot. If...

  • *** write in matlab *** use for loops largestfactor_for Write a function that takes a positive integer greater than one...

    *** write in matlab *** use for loops largestfactor_for Write a function that takes a positive integer greater than one and returns its largest factor (other than itseir). You must use a for loop to solve this problem. Do not use functions factor), primes(), and divisors() . Do not use while loops Do not use vectorized code. alargestfactor 105) 35 largestfactor_for Write a function that takes a positive integer greater than one and returns its largest factor (other than itseir)....

  • Write an expression that executes the loop while the user enters a number greater than or...

    Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with userNum initially 9 and user input of 5, 2, -1, then with userNum initially 0 and user input of -17, then with userNum initially -1. See "How to Use zyBooks". . Also note: If the submitted code has an infinite loop, the system will...

  • Write an expression that executes the loop while the user enters a number greater than or...

    Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9, 5, 2, -1, then with user input of 0, -17, then with user input of 0 1 0 -1. Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds,...

  • Write a MATLAB script, using either a single or nested for-loop, that will print the factorials...

    Write a MATLAB script, using either a single or nested for-loop, that will print the factorials for the numbers between 1 and 100 (inclusive). The factorial of n (n!) is the product of the positive integers less than or equal to n. For example: 3! = 3 * 2 * 1. For this question you cannot use the built-in MATLAB factorial function, but you can use other MATLAB functions if you wish. MATLAB code!MATLAB code!MATLAB code!MATLAB code!

  • MATLAB Write a function called next_prime that takes a scalar positive integer input n. Use a whi...

    MATLAB Write a function called next_prime that takes a scalar positive integer input n. Use a while-loop to find and return k, the smallest prime number that is greater than n. Feel free to use the built-in isprime function (do not use nextprime). MATLAB

  • Implement a while loop counter in Marie 1) Get a number from the user greater than...

    Implement a while loop counter in Marie 1) Get a number from the user greater than zero 2) Use the number as loop limit; while loop 3) Display counter value 4) Increment loop counter variable, i by 2

  • Matlab ( True or False questions ) Statement while - end does not need a "conditional...

    Matlab ( True or False questions ) Statement while - end does not need a "conditional expression" Given a recursive problem, there is only one way to program a while - end loop A while - end loop will run forever unless one statement alters the "conditional expression" The loop while -9 == -9 end will not run forever Counting by one is always done by statement i = i + 1 Dividing 1 by 27 can be accomplished by...

  • In C programming: Find the First number greater than 1000 that is divisible by 73. By...

    In C programming: Find the First number greater than 1000 that is divisible by 73. By using both solutions: Solution 1: Start num at 1001 and loop while NOT divisible by 73. Solution 2: Start num at 73 and loop by 73 until num > 1000. I need a total of two programs in C language using both scenarios.

  • in matlab please and do not use while or for ty for your time 4. Write...

    in matlab please and do not use while or for ty for your time 4. Write the function ExpSeries that will take a real number x as input, and return the result of the following summation: rrr? r? rº + + 0! 1!2! 3! 9! + + You can use the built-in function factorial. This series actually approximates the function et. You can check your function by comparing its result with that of the built- in function exp.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT