C++ 2-D Arrays | Set-1
Submissions: 10406   Accuracy:

34.74%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given an 2-d array of integers having N*N elements, print the transpose of the array. 

Input: 
The first line of input contains integer T denoting the number of test cases.  For each test case there will be two lines. First line contains an integer N denoting the size of the array A, and second line contains N*N space seperated integers of 2-d array A.

Output: 
For each test case, print the transpose of the array.

Constraints:
1 <= T <= 100
1 <= N <= 100
0 <= A[i] <= 1000

Example:
Input:
1
3
1 2 3 4 5 6 7 8 9
Output:
1 4 7 2 5 8 3 6 9

** For More Input/Output Examples Use 'Expected Output' option **

Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.