This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS100M Section Exercise 3 1 for while [P2.3.2 from FVL ] Define an integer as good if it is not divisible by 2, 3, 5, or 7. Write a script that displays the number of positive good integers less than one million. (a) Use a for-loop. (b) Use a while-loop. 2 Matlab graphics: circles & rectangles Complete the script below to draw as many non-overlapping circles as possible inside a rectangle. The diameter of each circle is the width of the rectangle. Center the set of circles inside the rectangle. Assume that functions DrawRect and DrawDisk are available. Read the function comments, shown below, to find out how to use the functions. Assume that all the graphics commands for setting up a figure window have been enteredwrite only the code to draw the rectangle and circles. Use a loop to draw the circles! Problem Solving Strategy : Work on a problem in steps! Solve a simpler version firstdraw the first circle tangent to the left side of the rectangle. After you figure out this simpler version, then modify your code to center theto the left side of the rectangle....
View Full Document
- Fall '07