For each of the following, decide whether you would use a for loop, a while loop, a nested loop (and if so what kind, e.g. a for loop inside of another for loop, a while loop inside of a for loop, etc.), or no loop at all. DO NOT WRITE THE ACTUAL CODE.
- sum the integers 1 through 50:
- add 3 to all numbers in a vector:
- prompt the user for a string, and keep doing this until the string that the user enters is a keyword in MATLAB:
- find the minimum in every column of a matrix:
- prompt the user for 5 numbers and find their sum:
- prompt the user for 10 numbers, find the average and also find how many of the numbers were greater than the average:
- generate a random integer n in the range from 10 to 20. Prompt the user for n positive numbers, error-checking to make sure you get n positive numbers (and just echo print each one):
- prompt the user for positive numbers until the user enters a negative number. Calculate and print the average of the positive numbers, or an error message if none are entered:
- prompt the user for positive numbers until the user enters a negative number. Calculate and print the average of the positivenumbers, or an error message if none are entered: while loop
need an explanation for this answer? contact us directly to get an explanation for this answer