title: Can I get some assistance with my homework having to do with counter-controlled repetition and arguments?
body: <p>Okay, so I need to have the output look like a diamond of asterisks, with each row increasing by 2 asterisks until the middle has 9 asterisks...and then the rows decrease. function main has to be:  </p>
  
  <pre><code>int main (void){  
     int i;    
     i = 0;  
     while (i &lt; 5){  
        printline (4-i, i*2+1);  
        i = i + 1;  
     }  
     i = 3;  
     while (i &gt;= 0) {  
        printline (4-i, i*2+1);  
        i = i - 1;  
     }  
     return 0;  
  }  
  </code></pre>
  
  <p>Now I am supposed to define function printline to print a single line of the figure each time it is called. It takes 2 arguments, the number of spaces and the number of asterisks that should be printed on the line. Use counter controlled repetition to print the appropriate number of spaces and again to print the appropriate number of asterisks.  </p>
  
  <pre><code>char print_line (int spaces, int stars){  
     for (int i = 4; i&gt;=spaces; i--){  
        printf(" ");  
     }  
     for (int i = 1; i&lt;=stars; i+=2){  
        printf("*");  
     }  
     printf("\n");  
  }
  </code></pre>
  
  <p>Woohoo! I'm almost done! The outputs kinda right, except that instead of a line with 4 spaces with a star, a line with 3 spaces with 3 stars, and so on up to no spaces and 9 stars, (and then reverses)...I get a line with a star, a line with a space and 2 stars, a line with two spaces three stars, etc, up to 4 spaces five stars (and then reverses)...<br>
  The reason printline is different is because I have problems writing with this sometimes and I kept on getting italics whenever I tried to write it...</p>