In: Computer Science
Using MATLAB or Octave, Write a script that prompts the user for a minimum and maximum real number, then generates and prints a random number in the requested range. The script should then do the same for an integer range. Sample output: Enter a minimum real value: 0.5 Enter a maximum real value: 30 A random number in the range ( 0.5000, 30.0000 ) is 1.7851 Enter a minimum integer value: -10 Enter a maximum integer value: 20 A random integer in the range [ -10, 20 ] is 8 Enter a minimum real value: -5 Enter a maximum real value: 5 A random number in the range ( -5.0000, 5.0000 ) is -4.5644 Enter a minimum integer value: 50 Enter a maximum integer value: 75 A random integer in the range [ 50, 75 ] is 65
n = input('Enter a minimum real value: '); % read minimum
value
m = input('Enter a maximum real value: '); % read maximum
value
num = (m - n) * rand(1, 1) + n; % generate a random number between
n amd m
fprintf("A random number in the range ( %f, %f ) is %f\n", n, m,
num); % display result
n1 = input('Enter a minimum integer value: '); % read minimum
value
m1 = input('Enter a maximum integer value: '); % read maximum
value
num1 = floor((m1 - n1) * rand(1, 1) + n1); % generate a random
integer between n1 amd m1
fprintf("A random integer in the range [ %d, %d ] is %d", n1, m1,
num1); % display result
FOR HELP PLEASE COMMENT.
THANK YOU