Last active
October 11, 2020 21:37
-
-
Save rohanrhu/75d698a72e8c85a600c3d99d61a08b7f to your computer and use it in GitHub Desktop.
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> | |
int main() { | |
int base = 50; | |
int ls = base/2; | |
int ms = 0; | |
for (int i=0; i < (base/2)+1; i++) { | |
if (i == base/2) { | |
for (int j=0; j < base; j++) { | |
printf("*"); | |
} | |
if (base % 2 == 0) { | |
printf("*"); | |
} | |
continue; | |
} | |
for (int j=0; j < ls; j++) { | |
printf(" "); | |
} | |
printf("*"); | |
if (ls == base/2) { | |
printf("\n"); | |
} else { | |
for (int k=0; k < ms; k++) { | |
printf(" "); | |
if (k == ms-1) { | |
printf("*\n"); | |
} | |
} | |
} | |
ls--; | |
ms++; | |
if (i > 0) ms++; | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment