I am stuck. I can only get one line to print a # and my spaces are correct. I am new to C and it is either scope is wrong or my logic is just off. I need to get unstuck and hints would be great.

while((h < 0  || h > 23));
    if  (h >= 1 && h <= 23)
        for (int l; l <= h; l++)

other issue

for(int a = 1; a <= (l + 1); a++)
  • Let's see now... Have you watched the walkthrough?
    – i_am_david
    Jul 31, 2015 at 3:01
  • Also there are some lines with an odd number of # so you probably shouldn't print the by two in each line. You should also do something in case h < 0 || h > 23. You are just invoking an infinite loop.
    – ChrisG
    Jul 31, 2015 at 6:41

1 Answer 1


it is hard to tell from just those snippets but my hunch is, the first loop is not working because int l does not have an initial value. You simply state

for (int l; l <= h; l++)

and you should probably start like this:

for (**int l = 1**; l <= h; l++)

** in this case are just highlighters :-)

Maybe this works, but as I said, it is hard to tell without more code for context.

  • IT still does not work with your suggestion. I tried that. Here is whole code Aug 3, 2015 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .