急!!!!!!!!我是学习C语言初级的,下面一个小问题,请各高手帮忙呀!!!!

2024-11-20 19:21:31
推荐回答(2个)
回答1:

//---------------------------------------------------------------------------

#include
#include
#define psa putchar('*');
#define psp putchar(' ');
#define psn putchar('\n');

int main(int argc, char* argv[])
{
int c,i,j;
printf("INPUT:");
scanf("%d",&c);
for (i = 0; i psa
psn
for (i = 2; i<=c; i++) {
for (j=0; j<=c-i; j++) {
psp
}
psa
for (j=1; j<2*(i-1); j++) {
psp
}
psa
psn
}

for (i = c-1; i>=2; i--) {
for (j=0; j<=c-i; j++) {
psp
}
psa
for (j=1; j<2*(i-1); j++) {
psp
}
psa
psn
}
for (i = 0; i psa
psn
system("pause");
return 0;
}
//---------------------------------------------------------------------------

回答2:

要用循环做的啊,蛮复杂的哦,蛮搞脑子的,做这种题要小心点,一不留神就会出错的啊。