Ordering matrix components

I'm new here but i heard here i can find a helpful community.I have to solve this problem:It reads a square matrix of order n from keyboard.
Order in ascending order main diagonal elements.

for example:
n=3
matrix is this
4 9 2
1 8 7
2 8 1

after solving it should look like this:
1 9 2
1 4 7
2 8 8

Any ideeas?

Thanks in advance!
Topic archived. No new replies allowed.