Question: 1 ) ( 1 0 pts ) Write a function to ask the user for a number within a given range. The function has two

1)(10 pts) Write a function to ask the user for a number within a given range. The function
has two input arguments which are the lower and upper limits of the number. The function
returns the correct user entered number as the output argument.
Inside the function, we ask the user to type of number within the range. If the number is
outside the range, the function keeps asking until the user provides a correct number.
Specific Requirements:
(1) Your function should match exactly the outputs below when tested in the command
window.
(2) You should use sprintf() to create a customized prompt message for input() based on the
value of a variable. Below is an example to create a customized prompt message for input()
function:
NAME = 'John';
MSG = sprintf('Hi %s, where are you from? ', NAME);
NUM = input(MSG)
(3) Do not use break or while true in your code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!