Exercise 10 Solution
repeatflag = true;
count = 0;
while true==repeatflag,
count = count + 1;
rr = randi([0 50]);
fprintf('Trial %d, Number %d\n', count, rr);
if rr>25,
repeatflag = false;
fprintf('It took %d attempt(s).\n', count);
end
end
For more details, please contact me
here
.