/*
 * This is a application which print diamond stars.
 * OS: Windows XP
 * Compiler: Visual C++ 6.0
 */
#include <stdio.h>
int main(void)
{
     int i, j, k, n;
     while(1)
     {
          printf("input a number(0 to stop): ");
          scanf("%d", &n);
          if (n <= 0)                                      // control the program
               break;
          for (i = 0; i < n; i++)                      // cycle for line
          {
               for (j = 0; j < n - i - 1; j++)       // cycle for printing blank
                    printf("%2c", ' ');      
               for (k = 0; k < (2 * i +1); k++) // cycle for printing '*'
                    printf("%2c", '*');
               putchar('\n');                           // move to the new line
          }
          for (i = 0; i < n - 1; i++)
          {
               for (j = 0; j < i + 1; j++)
                    printf("%2c", ' ');
               for (k = 0; k < 2 * (n - i - 2) + 1; k++)
                    printf("%2c", '*');
               putchar('\n');
          }
     }
     return 0;
}