打印菱形“*”星号组合

#include<stdio.h>

int main()

{

    int i,j,n;

    for(i=0;i<4;i++)

    {

        for(n=0;n<4-1-i;n++)

        {

            printf(“ ”);

        }

        for(j=0;j<2*i+1;j++)

        {

            printf("*");

        }

        printf("\n");

    }

    for(i=0;i<4-1;i++)

    {

        for(n=0;n<i+1;n++)

        {

            printf(" ");

        }

        for(j=0;j<2*(4-1-i)-1;j++)

        {

            printf("*");

        }

        printf("\n");

    }

    return 0;

}



   *

  ***

 *****

*******

 *****

  ***

   *

猜你喜欢

转载自blog.csdn.net/qq_42164474/article/details/80245770
今日推荐