C codung

sakthi.eeswari's Avatar
Go4Expert Member
I need a C coding for the following program

Code:
              1
            2   2
         3    3    3
      4    4     4   4
   5    5     5     5    5
Plz help me
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Here it comes

Code: C
void main()
{
    int row,col,sp=4,res;
    for(col=1;col<=5;col++)
    {
        res=sp;
        for(;sp>0;sp--)
            printf("  ");
        res--;
        sp=res;
        for(row=1;row<=col;row++)
            printf("%d ",col);
        for(row=col-1;row>0;row--)
            printf("%d ",col);
        printf("\n");
    }
}
0
sakthi.eeswari's Avatar
Go4Expert Member
Hi,
I got the result.Thanks for the coding.
-Sakthi
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Its my pleasure.