title: Why do I get a new line which is not there
body: <p>I am learning C and when I write the following code and compile it there is one extra line printed.</p>
  
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(void)
  {
      //set the int for height
      int height;
      //using do while loop to get the numbers between 1 to 8
      do
      {
          //using get_int helps get the positive number
          height = get_int("How High should be your Pyramid (Choose Between 1 - 8): ");
      }
      //this condition helps locking the numbers entered between 1 to 8
      while (height &lt; 1 || height &gt; 8);
      //for loop used for drawing # on screen at required hight entered by the user
      for (int i = 0; i &lt;= height ; i++)
      {
          //BlankSpace int is used to find the number of blank spaces to move # to the right
          int BlankSpace = height - i;
          for (int k = 0; k &lt; BlankSpace; k++)
          {
              //prints blank space to move right
              printf(" ");
          }
          //this will print # after the blank space
          for (int j = 0; j &lt; i; j++)
          {
              printf("#");
          }
          // move to new line
          printf("\n");
      }
  }
  </code></pre>
  
  <p>When I compile and run the file this is what it outputs:<br>
  <code>$ How High should be your Pyramid (Choose Between 1 - 8):</code><br>
  When we provide anything from 1 to 8 it should look like this</p>
  
  <pre class="lang-none prettyprint-override"><code>$ How High should be your Pyramid (Choose Between 1 - 8): 8
         #
        ##
       ###
      ####
     #####
    ######
   #######
  ########
  $
  </code></pre>
  
  <p>but what I get is the following:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ How High should be your Pyramid (Choose Between 1 - 8): 8
  
         #
        ##
       ###
      ####
     #####
    ######
   #######
  ########
  $
  </code></pre>
  
  <p>As you can see there is a line between </p>
  
  <pre><code>$ How High should be your Pyramid (Chose Between 1 - 8): 8
  
         #
  </code></pre>
  
  <p>Remember $ is the shell prompt.</p>