Number Pattern Program in C - 56


c program for pattern


/*
Write a program in C for Number Pattern Program
*/

int main()
{
    int i,j,k=1;
    int m[5][5]={0};
    for(i=0;i<5;i++)
    {
        for(j=i;j<=4;j++)
            m[j][i]=k++;
    }
    for(i=0;i<5;i++)
    {
        for(j=0;j<5;j++)
        {
            if(m[i][j]==0)
                printf(" ");
            else
                printf("%d ",m[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Post a Comment

0 Comments