Answers for "reversing 2d array row to column and column to row in c"

C
0

reversing 2d array row to column and column to row in c

int ara[5][5],ara2[5][5];
    printf("Enter rows and columns:\n");
    int i,j;
    for(i=0;i<5;i++){
        for(j=0;j<5;j++){
            printf("(%d %d):\n",i,j);
            scanf("%d",&ara[i][j]);
        }
    }


    printf("newly created array:\n");
    for(i=0;i<5;i++){
        for(j=0;j<5;j++){
            printf("%d ",ara[i][j]);

        }
        printf("\n");
    }

    for(i=0;i<5;i++){
        for(j=0;j<5;j++){
          ara2[j][i]=ara[i][j];

        }

    }

    printf("After customizing:\n");
    for(i=0;i<5;i++){
        for(j=0;j<5;j++){
            printf("%d ",ara2[i][j]);

        }
        printf("\n");
    }
Posted by: Guest on August-15-2021

Code answers related to "C"

Browse Popular Code Answers by Language