Printing a character multiple times in a for loop : <p>I want to use printf and for loop to print a character multiple times per line depending on the input; i.e. if the input is 3 i want to print:</p>

<pre><code>a
aa
aaa
</code></pre>

<p>this is the loop, which doesn't work at all.</p>

<pre><code>for (int i = 0; i &lt; n; i++)
{
    printf("a", i);
    printf("\n");
}
</code></pre>

<p>I just don't understand how to print it multiple times on a single line.</p>
