Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using MatLab Question 3: Write a program that continuously asks the user to ente

ID: 668084 • Letter: U

Question

Using MatLab

Question 3: Write a program that continuously asks the user to enter numbers until the user enters a number bigger than 100. The numbers before the last one (non-negative numbers) are saved in a vector B. Then display B and the average value in B. For instance, if the user enters 3, 5, 0, 7, 11, 130, the input stops and B is [3, 5, 0, 7, 11]. The average value of B is 5.2. Use loop. Do not use sum () or mean () built-in functions. Hint: How do you save a number x to B? B=[B x]

Explanation / Answer

count = 0; while (number > 1) number = number / 2; % must "move" toward end of loop count = count + 1; end