title: Print out mario two half pyramid CS50
body: <p>Hey I'm working on the CS50 more comfortable problem and I can't figure out how to print the second mario pyramid on the same line. In my code it already prints out, but it's not on the same line.</p>
  
  <p>It doesn't matter if you guide me or show me how to do it. I'm using CS50 as a practice, I'm not turning anything in. So this wouldn't be cheating.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;ctype.h&gt;
  
  int main(void)
  {
      int height = 0;
  
      // left pyramid variables
      int i = 0;
      int j = 0;
      int k = 0;
  
      // variable for gap
      int g = 0;
  
      // right pyramid variables
      int l = 0;
      int m = 0;
      int n = 0;
  
  
      //do - while loop -- works
  
      do
      {
          printf("Height: ");
          scanf("%d", &amp;height);
      }
  
      while (height &lt; 0 || height &gt; 23);
  
      // Print pyramids
  
          // print spaces for left pyramid (less spaces needed with time) ✓
          // print hashes for left pyramid ✓
          // print gap (2)
          // print hashes for right pyramid
          // print new line - for next row
  
      // Left Pyramid
  
      // Rows -- determines the height
      for (i = 0; i &lt; height; i++)
      {
          // Cols -- in this one we are doing the spaces
  
          // the -i makes it left aligned -- to make it right aligned remove the "-1"
          for (j = 0; j &lt; height-i; j++)
          {
              // Printing Spaces
              printf(" ");
          }
          // "i+1" - we want i to be 1 whenever height is 0, and we want i to increase by one
          // whenever the height increases, so that's why we add + 1 to it
          // if I don't add 1 to it what it does is that prints a new line, and then it prints
          // 4 things instead of 5 for example.
          for (k = 0; k &lt; i + 1; k++)
          {
              printf("#");
          }
  
          // Print new line
          printf("\n");
      }
  
      // Gap -- fix gap, the rest works how it should -- I think I need to make everything
      // inside one loop
  
      // for (g = 0; g &lt; height; g++)
      // {
      //     printf("  ");
      // }
  
      // Right Pyramid
  
        // Rows -- determines the height
      for (l = 0; l &lt; height; l++)
      {
  
          // Cols -- in this one we are doing the spaces
  
          // right aligned
          for (m = 0; m &lt; height; m++)
          {
              // Printing Spaces
              printf(" ");
          }
          // "i+1" - we want i to be 1 whenever height is 0, and we want i to increase by one
          // whenever the height increases, so that's why we add + 1 to it
          // if I don't add 1 to it what it does is that prints a new line, and then it prints
          // 4 things instead of 5 for example.
          for (n = 0; n &lt; l + 1; n++)
          {
              printf("#");
          }
  
          // Print new line
          printf("\n");
       }
  
  
      return 0;
  }
  </code></pre>