用c语言编写程序输出下列图形4
发布网友
发布时间:2023-10-19 03:14
我来回答
共2个回答
热心网友
时间:2024-11-28 22:47
#include <stdio.h>
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;
}
热心网友
时间:2024-11-28 22:48
编程的只能自己慢慢研究才会进步咯~~这个需要用到循环嵌套追问考试呢,顽皮,怎么自己研究