If you just print it out, you do this.
#include <stdio.h>
int main() {
printf("\n");
//upper part
for (int i=3; i <= 4; i++) {
for (int j=0; j < 6 - i; j++) {
printf(" ");
}
for (int j=0; j < i * 2 + 1; j++) {
printf("*");
}
printf("\n");
}
//Lower part
for (int i=1; i <= 6; i++) {
for (int j=0; j < i; j++) {
printf(" ");
}
for (int j=0; j < (6 - i) * 2 + 1; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
© 2024 OneMinuteCode. All rights reserved.