Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void stars(const unsigned long size)
- {
- const unsigned long half = (size + 1) / 2;
- for (long i = 1; i <= size; ++i)
- {
- const unsigned long initspace = (i <= half ? i : size + 1 - i);
- printf("%*c", initspace, '*');
- if (size % 2 == 0 || i != half)
- {
- printf("%*c", size + 1 - initspace * 2, '*');
- }
- putchar('\n');
- }
- }
Add Comment
Please, Sign In to add comment