Last active
March 26, 2018 02:25
-
-
Save myungseokang/bf0e6920760ac8b466cfbac97680a729 to your computer and use it in GitHub Desktop.
Star of David
This file contains 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> | |
void main() { | |
int i, j, k, num; | |
scanf("%d", &num); | |
for(i=0; i<num; i++) { | |
for(j=0; j<num*2+1; j++) printf(" "); | |
for(k=i; k<num; k++) printf(" "); | |
for(j=0; j<=i; j++) printf("*"); | |
for(j=0; j<i; j++) printf("*"); | |
printf("\n"); | |
} | |
for(i=num-1; i>0; i--) { | |
for(j=0; j<2; j++) printf(" "); | |
for(k=i; k<num; k++) printf(" "); | |
for(j=0; j<=i+num*2-1; j++) printf("*"); | |
for(j=0; j<i+num*2-1; j++) printf("*"); | |
printf("\n"); | |
} | |
for(i=0; i<num; i++) { | |
for(j=0; j<=2; j++) printf(" "); | |
for(k=i; k<num-1; k++) printf(" "); | |
for(j=0; j<=i+num*2-1; j++) printf("*"); | |
for(j=0; j<i+num*2-1; j++) printf("*"); | |
printf("\n"); | |
} | |
for(i=num; i>0; i--) { | |
for(j=0; j<=num*2+1; j++) printf(" "); | |
for(k=i; k<num; k++) printf(" "); | |
for(j=0; j<i-1; j++) printf("*"); | |
for(j=0; j<i; j++) printf("*"); | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment