sec3 - CS100M Section Exercise 3 1 for → while[P2.3.2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 entered—write 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 first—draw 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

{[ snackBarMessage ]}

Page1 / 2

sec3 - CS100M Section Exercise 3 1 for → while[P2.3.2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online