title: Programming in C - CS50 Mario pyramid blocks print - For loops difficulties
body: <p>I am working on this problem from the CS50 class. I am still a beginner. What I need to program is this:</p>
  <blockquote>
  <p>Toward the end of World 1-1 in Nintendo’s Super Mario Brothers, Mario
  must ascend right-aligned pyramid of blocks, a la the below.</p>
  <p>screenshot of Mario jumping up a right-aligned pyramid</p>
  <p>Let’s recreate that pyramid in C, albeit in text, using hashes (#) for
  bricks, a la the below. Each hash is a bit taller than it is wide, so
  the pyramid itself is also be taller than it is wide.</p>
  <pre><code>       #
        ##
       ###
      ####
     #####
    ######
   #######
  ########
  </code></pre>
  <p>The program we’ll write will be called mario. And let’s allow the user
  to decide just how tall the pyramid should be by first prompting them
  for a positive integer between, say, 1 and 8, inclusive.</p>
  </blockquote>
  <p>However I have tried many ways, two of which are these:</p>
  <ol>
  <li><p><a href="https://i.stack.imgur.com/RAYmc.jpg" rel="nofollow noreferrer">code mariov1</a></p>
  </li>
  <li><p>After looking at some Stack Overflow attempts, it now looks like this:</p>
  </li>
  </ol>
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
  string hash(int);
  
  int main(void)
  {
      int n;
      do
      {
          n = get_int(&quot;Height: &quot;);
      }
      while (n &lt; 0 || n &gt; 8);
      for(int i = 0; i &lt; n; i++)
      {
          for(int j = 0; j &lt; n-1-i; j++)
          {
              for(int j = 0; j &lt; i+1; j++)
              {
                  printf(&quot;.&quot;);
              }
              printf(&quot;#&quot;);
          }
          printf(&quot;\n&quot;);
      }
      
  
  }
  </code></pre>
  <p>What can I try next?</p>