[Solved] Pattern Programmings


#include<stdio.h>
#include<conio.h>

int main()
{

    int n=3,i,j,k,l,m;
    clrscr();
    for(i=0;i<n;i++)
    {
        for(j=0;j<n-i-1;j++)
            printf(" ");
        for(k=0;k<=i-1;k++)
            printf("*",k+1);
        for(m=0;m<1;m++)
        {
            if(i<=0)
                printf("*");
            else
                printf(" ");
        }
        for(l=i-1;l>=0;l--)
            printf("*",l+1);
        printf("\n");
    }
    for(i=0;i<n-1;i++)
    {
        for(j=0;j<=i;j++)
            printf(" ");
        for(k=0;k<n-i-2;k++)
            printf("*",k+1);
        for(m=0;m<1;m++)
        {
            if(i==1)
            {}
            else
                printf(" ");
        }
        for(l=1;l>0;l--)
            printf("*",l+1);
        printf("\n");
    }  
    getch();
    return 0;
}

Finally I got my solution by myself.

3

solved Pattern Programmings