Program for transposing a given matrix