Question: Use while-end, i f -end, break commands to solve the numerical problem Write a script file named PBTask3pS.m that sums a sequence of random numbers

Use while-end, i f -end, break commands to solve the numerical problem

Write a script file named PBTask3pS.m that sums a sequence of random numbers (use rancin) until the sum is greater than 10. If the random number generated is greater than 3, exit the loop immediately without doing the sum.

Display the sum of the random numbers and the last random number generated in command window when the program terminates. The display format may like this:
>> PBTask3p5

The sum of the random numbers is: 10.571232

The last random number generated is: 1.618112

Step by Step Solution

3.32 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To tackle the problem youve described well write a MATLAB script named PBTask3pSm The script will use while if and break structures alongside the rand ... View full answer

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!