View Code of Problem 53

#include <stdio.h>
int main()
{
    int a,b,c,d,e,f,i,h;

    printf("输入高度: ");

    while(scanf("%d",&a)!=EOF)
    {
           f=c=h=a;
            while(h)
    {
        for(i=h-1;i>=0;i--)
        {
            printf(" ");
        }
        for(b=(2*h-1);b<=(2*c-1);b++)
        {
            printf("*");
        }
        printf("\n");
        h--;
    }

    e=f-1;
    while(e)
    {
        for(c=e;c<=f;c++)
        {
            printf(" ");
        }
        for(d=1;d<=(2*e-1);d++)
        {
            printf("*");
        }
        printf("\n");
        e--;
    }
        printf("\n");
    }
    return 0;

}

Double click to view unformatted code.


Back to problem 53