Assuming that you input the matrix in the console, the shortest way would be to take every line as a string into a vector, then put in a reverse iterator loop while couting it.
But if it's hardcoded into a plain array and if you must use 2 for loops, you would nest the loops as if you are printing it, but for the y loop, make y = height, and while y>0, do --y.