代码如下:
#include <stdio.h>
int main(int argc, const char *argv[])
{
int i = 0;
int j = 0;
for(i=0;i<6;i++){
for(j=0;j<i+1;j++){
printf(" ");
}
for(j=0;j<8;j++){
printf("*");
}
printf("\n");
}
return 0;
}
终端运行结果:
ubuntu@ubuntu:C_base$ vi 23_test.c
ubuntu@ubuntu:C_base$ gcc 23_test.c
ubuntu@ubuntu:C_base$ ./a.out
********
********
********
********
********
********