Check The Programming Section
To sort the columns of a 2-d array we can apply bubble sort column wise. While comparing the items items are compared row-wise. Once all the items of a column placed in ascending order then next column is considered. The sort function will be called equal to the number of the columns. For example,
As input The number of rows and columns are given as 3, 3 as square matrix. In the second line 9 items are given as input. The required code is as follows: