Question: Loops can involve many repetitions, so printing during each pass through a loop is often impractical and undesirable. In some cases, a message or other

Loops can involve many repetitions, so printing during each pass through a loop is often impractical and undesirable. In some cases, a message or other clean-up work is done after the loop is finished.
Example 5 Compute the average of a list of numbersThe expression x= rand (1,n) creates a row vector of n pseudo-random numbers. The expression s=s+x(i) adds the ith element of x to the sum. As in Example 4, an initial value of s must be assigned before the loop starts. The average value (xbar) can only be computed after the loop is finished.
 Loops can involve many repetitions, so printing during each pass through

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 Databases Questions!