/*
**** 1 2
********** 2 5
************** 3 7
**************** 4 8
**************
**********
****
*/
#include <stdio.h>
int main(){
int i = 0;
for (int h = 1; h <= 7; h++) {
if(h <= 4){
for (int lie = 1;lie <= (-0.5)*h*h+4.5*h+6 ; lie++) {
if(lie <= 0.5*h*h-4.5*h+10){
printf(" ");
}else{
printf("*");
}
}
}else{
for (int lie = 1; lie <= -h*h+7*h+4; lie++) {
if (lie <= 0.5*h*h-3.5*h+7) {
printf(" ");
}else{
printf("*");
}
}
}
printf("\n");
}
return 0;
}
|
|