#include
int main()
{
int i, k ,n;
const int max = 7;
for ( i = max; i >=1; i -= 2 )
{
for ( n = 1; n <= (max - i) / 2; ++n )
printf(" ");
for ( k = 1; k <= i; ++k )
printf("*");
printf("\n");
}
for ( int i = 3; i <= max; i += 2 )
{
for ( n = 1; n <= (max - i) / 2; ++n )
printf(" ");
for ( k = 1; k <= i; ++k )
printf("*");
printf("\n");
}
return 0;
}
编程的只能自己慢慢研究才会进步咯~~这个需要用到循环嵌套