Last active
August 29, 2015 14:07
-
-
Save henrybear327/7d7d9fff80ae83c80ecd to your computer and use it in GitHub Desktop.
CCU programming course bonus question 1 solution 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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