$29
You and your roommates have embarked on a project to paint your room in a manner similar to the stars on the US flag.
The flag has 50 stars in alternating rows of 6 and 5.
You wish to represent that in your pattern maker like this:
* * * * * *
* * * * *
* * * * * *
* * * * *
* * * * * *
* * * * *
* * * * * *
* * * * *
* * * * * *
This pattern has 9 rows and there are 6 "stars" on row 1.
Rows 1, 3, 5, 7, and 9 have six stars.
Rows 2, 4, 6, and 8 have five stars.
We want to build a program to generate similar patterns based on the number of rows and the number of stars in the first row.
Program Description:
The user will provide the number of rows ("num_rows") and the number of stars in the first row ("num_symbols").
Construct a set of nested for loops that will print out the desired pattern using the * symbol.
The number of total rows in the pattern should be "num_rows".
The first row and all odd numbered rows should have "num_symbols" stars (*) in them, each separated by a space.
The even numbered rows should have one fewer star than the odd numbered rows.
Please view the sample runs and sample images to see how the pattern should look.
Sample Run:
Here are two examples of what your program should look like when its finished.
How many rows for your star design?
5
How many stars on the first row?
8
* * * * * * * *
* * * * * * *
* * * * * * * *
* * * * * * *
* * * * * * * *
---
How many rows for your star design?
2
How many stars on the first row?
17
* * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * *