Answer L32


#include <stdio.h>

void center(char ch, int count, int length)
{
  int blanks = length-count;
  int j;
  
  for ( j=0; j<blanks/2; j++ ) putchar( ' ' );
  for ( j=0; j<count;    j++ ) putchar( ch );
  
  putchar( '\n');
}

int main()
{
  center('*', 5, 13);  
  return 0;
}

Comments: The last third of the line in not printed here since it is blank.



Back to Puzzle Home