Does anyone notice any patterns?

Hi, I'm working on a nested for loops problem that wants us to output a large plus sign (user specifies the height which is odd and less than 30). For example, if the user enters a height of 9 this is what the output would look like:


1
2
3
4
5
6
7
8
9
      ***
      *  *
      *  *
****   ****
*              *
****   ****
      *  *
      *  *
      ***


I know that nested for loops are all about patterns -- once you notice them it's relatively straightforward to find the appropriate code. In this case, however, I can't identify any relationship between the rows and columns (or the specified height) although I do notice that the number of rows and columns will always the same (eg. 9x9 in the example above). Any ideas on how to tackle this one?

Last edited on
Somehow I can't get it to show properly... Just shift over the top and bottom "rectangle" portions and that last star to the left and it should come together to form a plus sign. If someone knows a way to post a picture, I could do that as well.
Maybe like this:
   ***   
   * *   
   * *   
**** ****
*       *
**** ****
   * *   
   * *   
   ***   
@Chervil Yes exactly! Now if I could just find some patterns...
Topic archived. No new replies allowed.