Skip to content

Instantly share code, notes, and snippets.

@rohanrhu
Last active October 11, 2020 21:37
Show Gist options
  • Save rohanrhu/75d698a72e8c85a600c3d99d61a08b7f to your computer and use it in GitHub Desktop.
Save rohanrhu/75d698a72e8c85a600c3d99d61a08b7f to your computer and use it in GitHub Desktop.
#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