5th Time's a Charm - MATLAB Cody - MATLAB Central

Problem 44359. 5th Time's a Charm

Difficulty:Rate

Write a function that will return the input value. However, your function must fail the first four times, only functioning properly every fifth time. Furthermore, the first four times the function is called, successively closer, but not correct, values must be supplied by the function.

For example, if x = 10, you may return any number not equal to 10 the first function call. Here, we will return 27. Then, the second function call must return a value between 27 and 10, but not equal to either, and so on, until 10 is returned the fifth time.

Solution Stats

31.68% Correct | 68.32% Incorrect
Last Solution submitted on Feb 20, 2025

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
2
4

Problem Recent Solvers190

Suggested Problems

More from this Author139

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page