title: How can I multiply a string in the C language?
body: <p>I want to "multiply" a string by an <code>int</code> variable that the user inputs.</p>
  
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
      // Height &lt; 24
  
      string block = "#";
      string output;
  
      int main(void) {
          printf("Height: ");
          int height = GetInt();
          while (true) { 
              if (height &lt; 24 &amp;&amp; height &gt; 0) {
                  output = "#" + block * height;
                  printf("%s\n", output); 
                  break;
  
              } else {
                  printf("Height: ");
                  height = GetInt();
              }
          }
          return 0;
      }
  </code></pre>
  
  <p>Using the <code>Height</code> variable I want to multiply the string variable <code>block (#)</code> by <code>Height</code>, and add that to another <code>"#"</code>. </p>
  
  <p>I tried implementing it in the only way I could think of it making sense however it doesnt seem the syntax is right. </p>
  
  <p>I've looked over StackOverflow on this subject and can only find C# and C++ topics with this question in mind.</p>
  
  <p>EDIT: After being printed the output should look like this: </p>
  
  <pre><code>       ##
        ###
       ####
      #####
     ######
    #######
   ########
  #########
  </code></pre>
  
  <p>And the lines of "#" being outputted depends on the Height variable that the user inputs. Say the user inputs a height of "5":</p>
  
  <pre><code>Height: 5
         ##
        ###
       ####
      #####
     ######
  </code></pre>
  
  <p>Should be output.</p>