Help me in solving DSAAGP51 problem

My issue

give the solution for this problem

My code

#include <stdio.h>

int main() {
    int n,m;
    scanf("%d %d",&n, &m);
    int a[n][m];
    int t[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            t[j][i]=a[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            printf("%d",t[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-dsa-c/MUJDSAC09/problems/DSAAGP51