Skip to content

Instantly share code, notes, and snippets.

@henrybear327
Last active August 29, 2015 14:07
Show Gist options
  • Save henrybear327/7d7d9fff80ae83c80ecd to your computer and use it in GitHub Desktop.
Save henrybear327/7d7d9fff80ae83c80ecd to your computer and use it in GitHub Desktop.
CCU programming course bonus question 1 solution 2
#include <stdio.h>
#include <stdlib.h>
int main()
{
char str1[] = "********************************************";
char str2[] = " ";
int space = 1, star, total;
scanf("%d", &star);
total= 2 * star + 1;
for(space = 1; star >= 0; space += 2, star--)
{
printf("%.*s%.*s%.*s\n", star, str1, space, str2, star, str1);
}
for(star = 1, space = total - 2; space > 0; star++, space = space - 2)
{
printf("%.*s%.*s%.*s\n", star, str1, space, str2, star, str1);
}
return 0 ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment