Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
1.44/5 (5 votes)
See more:
I wants to print matrix such that

Consider that original matrix look like following

1 2 3
4 5 6
7 8 9

Now I want to print like following

7 8 9
4 5 6
1 2 3

we can use only two for loops only .
Posted
Comments
Richard MacCutchan 23-Jan-15 8:53am    
Think about how you would do it with a pencil and piece of paper. Write down the necessary steps and then convert that to code.
[no name] 23-Jan-15 8:53am    
And the Problem is where? Seems to be only a question of 0...N-1 vs. n-1...0?
Rage 23-Jan-15 9:08am    
Show us first how you are printing the original matrix.
Sergey Alexandrovich Kryukov 23-Jan-15 12:42pm    
What have you tried so far?
—SA
CPallini 23-Jan-15 17:35pm    
Well, two loops are enough.

1 solution

only change the row counting to top-down :-O
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900