title: How to make the pyramid (CS50 Mario Program) formed by this code to be right aligned?
body: <p>Please help me create the pyramid with height "n" print correctly using hashes and spaces that is right-aligned. I have posted the code itself below. The program correctly asks for the user input, but doesn't build the pyramid right-aligned. If anyone can fix this, please help.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cs50.h&gt;
  
  int main(void)
  {
      int i=0;
      int n=0;
  
      do
      {
          printf("Height:");
          n=GetInt();
      } while (n&lt;0 || n&gt;23);
  
      for (i=0; i&lt;n; i++)
      {
          printf(" ");
          for (int x=0; x&lt;i+2; x++)
          {
              printf("#");
          }
          printf("\n");
      }
  
      return 0;
  }
  </code></pre>