Search C Program

Number Pattern - 55

1     
2 6    
3 7 10   
4 8 11 13  
5 9 12 14 15 

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;
}


Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C



2 comments:

  1. it's really a helpful site for me

    ReplyDelete
  2. int main()
    {
    int count=0;
    int n=5;

    for(int i=1;i<=n;i++) {
    {
    count=i
    for(int j=0;j0)
    count=(count+ n)-j;
    printf("%d ",count);
    else
    printf("%d ",i);
    }
    printf("\n");
    }
    return 0;
    }

    ReplyDelete