View Code of Problem 53

#include<stdio.h>
int main()
{
    int n,i;
    int blank,star;
    scanf("%d",&n);
    for(i=1;i<n;i++)
        {
            blank=n-i;
            while(blank--)
                 printf(" ");
            star=i*2-1;
            while(star--)
                 printf("*");
            printf("\n");
        }
    for(i=n;i>0;i--)
        {
            blank=n-i;
            while(blank--)
                 printf(" ");
            star=i*2-1;
            while(star--)
                 printf("*");
            printf("\n");
        }
    return 0;
}

Double click to view unformatted code.


Back to problem 53