1. ## Nested Loops

Hi, I have homework on a c problem.

I have been asked to create a program that uses nested loops to create the following output.

\$
\$\$
\$\$\$
\$\$\$\$
\$\$\$\$\$

Any suggestions?

Thanks!!

2. Originally Posted by wstayman
Hi, I have homework on a c problem.

I have been asked to create a program that uses nested loops to create the following output.

\$
\$\$
\$\$\$
\$\$\$\$
\$\$\$\$\$

Any suggestions?

Thanks!!
Welcome to the forum, Wstayman!

This is how I approach all small puzzles like this:

1) Unless you know how to solve it just from the introduction, grab a paper and pen, and forget the computer.

2) If it's not easy, make an easy similar example problem first, and solve it on paper with pen.

3) Note the steps you're using to solve it, VERY carefully. Repeat as needed. Before long, you will see the pattern you are using to solve it.

4) Break that pattern down into small steps. You want to change the big steps that a human might use, to the small steps a computer program can use.

These small steps, become the backbone of your pseudo code for your computer program.

5) Putting off the details as much as you can, transfer your pseudo code, into actual code, and refine the overall flow of the program.

Test it, to be sure it's basically correct.

6) Add in the details and check that everything still works as it should. Your testing here should be quite thorough.

These "nested loops" problems go well if you think about the outer for loop, as the loop for the rows (and controlling the rows), and the inner for loop as the loop for the individual printout for each column, in the current row.

Try working along these lines, and remember - practice builds proficiency, and that's certainly true with learning to solve problems like this.

3. Thank you so much for that!!!

I have successfully created the output by just doing what you said.

Thanks again!!

4. Originally Posted by wstayman
Thank you so much for that!!!

I have successfully created the output by just doing what you said.

Thanks again!!
Very good, and you are welcome!