title: C - Need to print a pyramid with #'s when the user inputs a height
body: <p>I need to have a user input a height value, if it's higher than 23 or less than 0 it should ask again. It should then print a pyramid of #'s sort of like the stairs at the end of a game of mario bros (with 2 hashtags on the right side, see example). The problem is that the code runs and doesn't print any #'s, the code just ends. This is for an online course so please don't just post the code, if you are going to post the full code please explain it.</p>
  
  <blockquote>
    <p>Pyramid example: <a href="https://www.dropbox.com/s/4fyg2ls0eml7asi/Screenshot%20from%202014-03-20%2002%3A15%3A08.png" rel="nofollow">https://www.dropbox.com/s/4fyg2ls0eml7asi/Screenshot%20from%202014-03-20%2002%3A15%3A08.png</a></p>
    
    <p>Flowchart that I followed: <a href="http://i.imgur.com/otuDOtK.png" rel="nofollow">http://i.imgur.com/otuDOtK.png</a></p>
  </blockquote>
  
  <pre><code>#include &lt;stdio.h&gt;
  //#include "cs50.h"
  
  int main(void){
      //int h = 0;
      printf("Enter height between 0 and 23: ");
      int h = scanf("%d", &amp;h);
      while (h &lt; 0 || h &gt; 23){
          printf("Retry: ");
          h = scanf("%d", &amp;h);
      }
      int l = 1;
      if (h == 0){
          //printf("ln21\n"); //Debug
          return;
      }
      int s = h - 1;
      int b = l + 1;
      if (s == 0){
          if (b == 0){
              printf("\n");
      h = h - 1;
      l = l + 1;
      if (h == 0){
          return;
      }
          }
      }
      else{
      printf("#");
      b = b - 1;
      }
  }
  </code></pre>