Guest User

Untitled

a guest
Sep 15th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. void stars(const unsigned long size)
  2. {
  3.     const unsigned long half = (size + 1) / 2;
  4.     for (long i = 1; i <= size; ++i)
  5.     {
  6.         const unsigned long initspace = (i <= half ? i : size + 1 - i);
  7.  
  8.         printf("%*c", initspace, '*');
  9.         if (size % 2 == 0 || i != half)
  10.         {
  11.             printf("%*c", size + 1 - initspace * 2, '*');
  12.         }
  13.         putchar('\n');
  14.     }
  15. }
Add Comment
Please, Sign In to add comment