title: Program keeps printing one extra line then what the user inputs
body: <p>I'm having some trouble trying to build a pyramid out of &quot;#&quot; for mario.c in problem set 1. My program seems to be having some trouble with handling input.</p>
  <p><strong>I get these errors:</strong></p>
  <pre><code>:( handles a height of 1 correctly
      expected &quot;&quot;#&quot;&quot;, not &quot;&quot; #&quot;\n&quot;##&quot;&quot;
  :( handles a height of 2 correctly
      expected &quot;&quot; #&quot;\n&quot;##&quot;&quot;, not &quot;&quot;  #&quot;\n&quot; ##&quot;\n...&quot;
  :( handles a height of 8 correctly
      expected &quot;&quot;       #&quot;\n&quot; ...&quot;, not &quot;&quot;        #&quot;\n&quot;...&quot;
  :( rejects a height of 9, and then accepts a height of 2
      expected &quot;&quot; #&quot;\n&quot;##&quot;&quot;, not &quot;&quot;  #&quot;\n&quot; ##&quot;\n...&quot;
  </code></pre>
  <p><strong>Here is my code:</strong></p>
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
  
  int main(void)
  {
      int height;
      do
      {
          height = get_int(&quot;How many rows for the pyramid?\n&quot;);
      }
      while (height &lt; 1 || height &gt; 8); //This loops until the user input 1 - 8 rows
      
      for (int row = 0; row &lt;= height; row++) //This says to print a new row until it reaches the user inputted height
      {
          for (int spaces = (height - (row + 1)); spaces &gt;= 0; spaces--) //This formula prints less spaces as more rows are printed
          {
              printf(&quot; &quot;);
          }
          for (int hashes = 1; hashes &lt;= (row + 1); hashes++) //This formula prints more hashes as more rows are printed
          {
              printf(&quot;#&quot;);
          }
          printf(&quot;\n&quot;);
      }
  }
  </code></pre>
  <p>Any help is appreciated!!</p>