Actually the problem arises when I take a non square matrix as an input and as the condition of transpose is given as if(i<j){ swap(a[i][j] , a[j][i]) }
But in a non square matrix some rows are left out due to this condition.
What can I do for this?