What is the difference between a break statement and a continue statement?

Matlab codes quick questions

Draw the flow diagrams for for loop and while loop, separately. (10 points)

What does a jump statement do to an iteration statement? What is the difference between a break statement and a continue statement? (10 points)

The Taylor series for the exponential function ex is given below. Write a script file using the proper iteration statement to read in a number x and calculate its exponential using Taylor series for the first 10 terms. (10 points)

1 + βˆ‘ (π‘₯^𝑛

𝑛! )

∞

𝑛=1

Write a script program using a proper loop statement to perform the following tasks: (20 points)

(1) Per-determine a random integer (rand_int) between [0-9] by the program (hint: use randi() ).

(2) Let the user guess a number (number) entered from the keyboard to be compared with the random integer (rand_int).

(3) If the value of number matches the value of rand_int, the program should display a message β€˜Bingo! The guessing is stopped by the program.’ and terminate.

(4) If the two values of number and rand_int are not matched, the program should ask whether the user wants to keep guessing by displaying β€˜Wrong guessing… try again?’.

(5) To continue guessing, a character β€˜Y’ or β€˜y’ should be entered from the keyboard; to stop guessing, a character β€˜N’ or β€˜n’ should be entered, and display β€˜The guessing is stopped by the user.’.

(Carefully examine through our in-class examples and exercises. Understand which loop should be used, which condition should be used for logical evaluation, and what the order of different commands should be within the loop. When you see specific keywords, e.g. keep, stop, terminate, continue, etc., know what iteration statement with jump statements should be used. Try making modifications to in-class demos to construct the program.)