{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

09-13 Class Notes CS 107

09-13 Class Notes CS 107 - Start with a program that give...

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

Program #3 will be released probably tomorrow Announcements: Questions? Last Time: for loops Today: More for loops: How can we display only a selected rectangular subset of the table? 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 Done. Time permitting: how to create a "centered" diamond shape What are the steps to writing a program to give me the above? Diamond is defined by widest row. Does this need to be an odd number? Number of rows is twice the width - 1 The number of characters on each line (including spaces) is equal to the number of rows.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Start with a program that give the top half only. Write a program that gives a "triangle" first, where each row is not centered, but is left justified. Issues / Ideas: 09-13 Class Notes CS 107 Monday, September 13, 2010 2:54 PM 107 Fall 2010 Page 1 Write code that prints out a single asterisk. Put that code in a loop, so I can choose how many asterisks appear on a line. Put a loop around *that* (the line above) so that I can print out yon triangle After we have that, THEN we can worry about centering each line, and then we can print the center line, and then do the same thing in reverse, to print the bottom half. See the code done in class to illustrate the above concepts. 107 Fall 2010 Page 2...
View Full Document

{[ snackBarMessage ]}