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
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:5| Question number:32.5
All Answers
need an explanation for this answer? contact us directly to get an explanation for this answer
- sum the integers 1 through 50: No loop
- add 3 to all numbers in a vector: No loop
- prompt the user for a string, and keep doing this until the string that the user enters is a keyword in MATLAB: while loop
- find the minimum in every column of a matrix: No loop
- prompt the user for 5 numbers and find their sum: for loop
- prompt the user for 10 numbers, find the average and also find how many of the numbers were greater than the average: for loop
- 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): while loop in a for loop
- 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
total answers (1)